useReducer vs useState
Multiple Choice Medium
Question
When should you prefer useReducer over useState?
Hint
Think about complex state logic with many possible transitions.
Explanation
useReducer is preferable when state has multiple related sub-values, when the next state depends on the previous in complex ways, or when you want to centralize and test state logic. For simple independent values, useState is simpler.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.