React Context API Interview Questions
Context comes up in every state-management discussion. Here are the questions and how to answer them well.
What problem does the Context API solve?
Prop drilling — threading a prop through many components that don't use it. Context provides a value to an entire subtree; descendants read it with useContext.
Why can Context hurt performance?
Every consumer re-renders when the Provider's value changes, even if it uses only part of it. Passing a fresh object literal as value re-renders everyone — memoize it with useMemo.
How do you optimise Context?
Memoize the value, split unrelated data into separate contexts, and for high-churn state use a store (Zustand/Redux) with selectors.
Is Context a replacement for Redux?
No — Context is a transport mechanism for passing values down, not a state manager. Pair it with useState/useReducer, and reach for a store when state is complex or high-churn.
How do you build a store with Context?
Put useReducer in a provider and share [state, dispatch] via context — splitting state and dispatch into two contexts so dispatch-only components don't re-render.
Master state management in React
Context, its pitfalls, and when to reach for a library — with interview context in the React Interview Kit.
⚡ Get the React Interview Kit → ₹399Frequently asked questions
- When should I use Context vs a library?
- Context handles theme/auth/locale well. Use React Query/SWR for server state and Zustand/Redux for complex, high-churn global client state.
- Does Context cause re-renders?
- Yes — all consumers re-render when the value changes. Memoize the value and split contexts to limit it.
