State Management · Junior · Question 11 of 75

When is useReducer usually a better choice than several useState calls?

Explanation

A reducer collects all transitions in one place, so they're easy to read and test, and handlers only describe what happened. For a single toggle useState is simpler. useReducer doesn't make state global by itself.

Further reading

Problem with a question

State Management · Junior · question 11

Test yourself

Take the State Management · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz