Chapter 8 · Example 6 · React Context and performance

Reducers and stable API

Switching from useState to useReducer makes toggle, open, and close dispatch actions without depending on state, so the api value never changes.

Loading live editor…