reading-notes

Context API

Review, Research, and Discussion

  1. Describe use cases useState() vs useReducer()
    • useState(): is better for being more precise with the data that you are trying to access from state.
    • useReducer(): is better to squish and mroe compress the data of state you are using.
  2. Why do custom hooks need the use prefix?
    • so React can tell the difference between a normal function and a react hook.
  3. What do custom hooks usually do?
    • depending on the hook, it can do whatever it is you want to do.
  4. Using any list of custom hooks, research and name one that you think will be useful in your applications
    • useLocalStorage
  5. Describe how a hook that fetches API data might work
    • a hook that calls an API using Axios, managing it with useState or useReducer.

Vocab

  1. reducer - manages change within state by handing an action.