reading-notes

Reading Notes

View the Project on GitHub simon-panek/reading-notes

Code 401: Class 33 - Context API


Questions

  1. Describe use cases for useMemo() and useReducer(). useMemo() will only recompute memoized value if one of the dependencies has changed. useReducer() is similar to useState() but works better for complex state logic or if the new state depends on the previous

  2. Why do custom hooks need the use prefix? So that it is clear to react if a function needs to maintain all of the hook rules.

  3. What do custom hooks usually do? Allow for the reuse of stateful logic.

  4. Using any list of custom hooks, research and name one that you think will be useful in your applications. useEffect() is a good way to have something happen after a render or every render

  5. Describe how a hook that fetches API data might work. useFetch() is a quick way to set up a fetch and provide state for isLoading

Vocabulary

Read: Context API

Read: Hooks and Context Example


Return to reading-notes Deployed Site

Return to reading-notes Mark Down