React Developer Interview Question

How do you choose between local state, Context and a state library like Redux or Zustand?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

Match the tool to the kind of state. Local useState for anything one component owns, the URL for anything shareable or bookmarkable, a query cache for server data, and Context for stable values like theme or the current user. Reach for a store only when you have genuinely global client state that many unrelated components read and write, and where you need selectors to avoid re-rendering everything.

Why interviewers ask this

This is an architecture question disguised as a tooling question. The interviewer wants to hear you classify state before choosing tools, because most Redux stores in the wild are ninety percent cached server responses that a query library would handle better. They are also checking that you can justify a choice on team and codebase grounds rather than personal preference or whatever is fashionable.

How to structure your answer

  • Classify the state first: server, URL, local, or global client.
  • Assign the default tool for each category.
  • Give your trigger for introducing a store at all.
  • Mention team factors: consistency, devtools, onboarding cost.

Example answer

Spoken example, first person

I try to work out what kind of state it is before I pick anything, because the biggest wins come from not putting it in a store in the first place. Server data goes to a query cache, since it needs deduplication, revalidation and invalidation, and none of that is state management, it is caching. Anything a user might want to link to or refresh into, like filters or the open tab, goes in the URL. Everything a single component owns stays in useState. Context I use for things that are stable, the theme, the signed in user, a client instance, because it has no selectors so frequent updates are expensive. What is left over is genuinely global client state, like a multi panel editor with shared undo, and that is when I bring in a store. I lean toward a small one with hook based selectors rather than Redux for a new project, but if a team already knows Redux Toolkit and has the devtools habits, consistency beats my preference every time.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • What would make you pick Redux Toolkit over a lighter store?
  • How do you handle derived state in whichever store you choose?
  • How would you migrate a store that is mostly cached API responses?

Related react developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot