Intermediate React Interview QuestionsIntermediateComparison
React · Question 39
What is the difference between useState and useReducer, and when would you choose each?
Direct answer
useState is usually simpler for independent state values, while useReducer is useful when several related updates form a state transition model that is easier to express with actions.
| Concern | useState | useReducer |
|---|---|---|
| Update API | Call a setter with the next value/updater | Dispatch an action |
| Best fit | Simple or independent state | Related state with multiple transition rules |
| Update logic | Often lives near event handlers | Centralized in a reducer |
| Debugging intent | Setter shows value change | Action can describe what happened |
A reducer does not make state global. useReducer() still manages state for the component instance unless you deliberately expose it through props or context.