jargon

Frontend & browser·State, data and re-rendering

you replaced five interacting `setState` calls with one function that takes the current state and an action.

Reducer

Also calleduseReducer, state machine reducer

A pure function from current state and a described action to the next state. Centralising transitions makes impossible combinations easy to rule out and makes every change loggable and replayable, which is why debugging tools are built around it. It is overkill for one boolean, and it is the right call the moment two pieces of state must change together or a transition depends on the current state.

Commonly confused with