WeCodeAcademy

useReducer

When state has several related changes, useReducer keeps the logic in one place. A reducer is a function (state, action) => newState, and you dispatch actions to it.

Examplereact
Open in editor »
Quick check

What does `dispatch({ type: "add" })` do?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.