Notes for Codefellows Code 401 301 201 and 102
source
useMemo()
You’re noticing a component’s render is frustratingly slow, and you’re passing a calculation to an unknowable number of children, such as when rendering children using Array.map()… or Your app often becomes unresponsive because you’re fetching a large amount of data, and having to transform it into a usable format
source
useReducer()
is usually preferable to useState when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one. useReducer also lets you optimize performance for components that trigger deep updates because you can pass dispatch down instead of callbacks.
source So that you can tell at a glance that the rules of Hooks apply to it
source Custom hooks allow us to have cleaner functional components, remove logic from the UI layer, and prevent code duplication by bringing common use cases to reusable hooks.
source
useLocalStorage
,useArray
, useReducer
source - Julien Edwards - go Julien need to set a loading state to flag when teh async is done - useEffect doesn’t play with async -
source a function that determines changes to an application’s state. It uses the action it receives to determine this change.
Skim the following materials in preparation for the upcoming lecture. Note the following as you browse the material, and be prepared to participate in discussions during lecture