Course lesson

Declaratively Interact with Complex Component State using the React useReducer Hook

Having to use useState for every item in your state quickly gets cumbersome. In this lesson, we’ll learn how to refactor our component to use useReducer instead.

Duration
3 min
Access
Free
Transcript
Available

Having to use useState for every item in your state quickly gets cumbersome. In this lesson, we’ll learn how to refactor our component to use useReducer instead.

We'll cover:

  • Creating an initial state with useReducer
  • Making a reducer function that makes changes to the state based on incoming dispatches