Skip to content

rafischer1/tea-first-store

Repository files navigation

React Store Project - Tea First Records

Resources

Images Available

PACKAGE DOCS

React

React Context

React Router

Redux Logger

Reselect

Redux Persist

Dingbats

React Stripe

Styled Components

Redux Saga


TYPESCRIPT CONVERSION

Redux Typescript Docs


NOTES

mapStateToProps

redux mapStateToProps has a shallow 
equality check for every value in the object; 
it won't replace values if they pass a shallow equality 
check which means it won't needlessly re-render,
but if we have transformation logic it's still valuable 
to memoize it with a selector to save us running 
duplicate logic to get the same output.

async fetches in useEffect

useEffect(() => {
  const genAsyncFunction = async () => {
    const asyncRes = await myOtherAsyncFunction()
    // do something with asyncRes (setX, contextUpdate, etc)
  }
  getAsyncFunction()
},  [])

FIREBASE BACKWARDS COMPAT FOR IMPORT ERROR:

So from:

import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';

to:

import firebase from 'firebase/compat/app';
import 'firebase/compat/firestore';
import 'firebase/compat/auth';