React State Management Interview Questions With Answers
State management is core React interview territory. Here are the common questions and how to answer them.
React State Management Interview Questions With Answers
State management is core React interview territory. Here are the common questions and how to answer them.
When do you use useState vs useReducer?
useState for simple independent state. useReducer for complex state with transitions, like a multi-step form. Choose based on complexity and clarity, not performance.
When do you use Context vs Redux?
Context for widely-shared, rarely-changed data like auth and theme. Redux for complex, frequently-updated shared state with many interactions. Reach for Redux only when Context is insufficient.
How do you lift state up?
Move the useState to the common parent of siblings that need it. The parent owns the state and passes it down as props, creating a single source of truth.
What is a single source of truth?
Each piece of data has one owner. Do not duplicate data between props and state, or across stores. Duplication causes sync bugs when one copy updates and another does not.
How do you avoid unnecessary re-renders?
Keep state local where possible, stabilize prop references with useMemo and useCallback, use React.memo for components that re-render often with the same props, and split Contexts by change rate.
How do you handle server state?
Treat it separately from client state. Use React Query or RTK Query for caching, invalidation, and loading. Do not put fetched data in Redux like client state, since it has different concerns.
The Takeaway
Know useState vs useReducer, Context vs Redux, lifting state up, single source of truth, avoiding unnecessary re-renders, and server state vs client state. Connect each tool to the problem it solves, not by default.
useState for simple independent state. useReducer for complex state with transitions, like a multi-step form. Choose based on complexity and clarity, not performance.
Context for widely-shared, rarely-changed data like auth and theme. Redux for complex, frequently-updated shared state with many interactions. Reach for Redux only when Context is genuinely insufficient.
Move the useState to the common parent of siblings that need the same data. The parent owns the state and passes it down as props, creating a single source of truth and preventing drift between siblings.
Each piece of data has one owner. Do not duplicate data between props and state, or across stores. Duplication causes sync bugs when one copy updates and another does not.
Treat it separately from client state. Use React Query or RTK Query for caching, invalidation, and loading. Do not put fetched data in Redux like client state, since it has different concerns like caching and refetching.
Ready to master React completely?
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.
Master React
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course.

