Server state is data you do not own: it lives in a database, it can be stale the moment it arrives, and it needs caching, revalidation, retries and deduplication. Client state is data you do own, such as which tab is open or what is typed in a form, and it is synchronous and always correct. Treat them differently: a query cache for server state, local component state or a small store for client state.
Why interviewers ask this
The interviewer wants to know whether you would still push API responses into a global store and hand roll loading flags. Separating the two is the insight behind modern data libraries, and it predicts how much accidental complexity your code carries. It also opens up follow ups about cache invalidation, optimistic updates and what happens when two components need the same data.
How to structure your answer
- Define both categories in terms of ownership.
- List what server state needs that client state does not.
- Name the tool you use for each and why.
- Give a symptom of getting it wrong.
Example answer
Server state is a cached copy of something I do not control. It arrives asynchronously, it can be stale, two components may want it at once, and it needs revalidation, retries and deduplication. Client state is mine: the open accordion, the draft in a form, the selected filter before I apply it. It is synchronous and it is never stale. Once I started treating them as different problems, a lot of code disappeared. Server data goes into a query cache keyed by its parameters, which handles the loading and error states, dedupes concurrent requests and refetches on focus. Client state stays as local component state until more than one component needs it, and only then does it move into a small shared store. The symptom of getting this wrong is very recognizable: a global store full of entities, hand written loading booleans on every screen, and a bug where two components fetch the same user and disagree about it. I have maintained that app and I would not build it again.
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 worksFollow-up questions to expect
- How do you handle an optimistic update that the server rejects?
- What is your invalidation strategy after a mutation?
- When does client state genuinely need to be global?
Related frontend 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