Chapter 02
State and updates
How component state behaves: each render sees a snapshot, updates are queued and batched, objects and arrays are replaced rather than mutated, and state is structured so nothing is stored twice.- 010Why does state still hold the old value right after you set it?Coremedium
- 020How does React batch state updates, and when do you need an updater function?Coremedium
- 030When should you use
useReducerinstead ofuseState?medium - 040Why must React state be updated immutably?medium
- 050How do you decide where state lives and what not to store?medium