Reading Notes for Day 29 of 401:
useReducer hook
-
Name an alternative to the useState Hook. Don’t use state. But apparently also useReducer.
-
Why might the useReducer Hook be preferable to the useState Hook? It’s preferable when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one.
-
What are two ways to set the initial state? You can pass the initial state as a second argument, you can pass an init function as the third argument (this is the lazy way, apparently).
Ultimate Guide to useReducer
-
In terms of state, what does useReducer expect to receive as a parameter? A reducer function.
-
What does useReducer return? A value (probably an updated state, but not necessarily.)
-
Explain dispatch to a non-technical recruiter. You’re setting up an activity so you can make it happen later.
Reflection
- What are your learning goals after reading and reviewing the class README? I am really coming to hate this question, since my learning goals are pretty much the same thing - figure out how to use the thing consistently and effectively.
Things I want to know more about:
Why does it seem like people talk constantly in coffee shops when I’m trying to study? It comes right through my headphones. And apparently asking them ‘politely’ to go somewhere else is frowned on by the the coffee shop employees.