State management and data fetching · senior
Choosing where state lives: server, client, URL and form state
Senior state-management answers start by classifying state: server data is a cache (TanStack Query, RTK Query, Server Components), shareable view state belongs in the URL, local UI state stays in components, form state goes to a form tool, and only truly shared client state needs a store.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Server state: owned by the server, you hold a copy that goes stale. Needs caching, dedupe, background refresh, invalidation. Use TanStack Query, RTK Query, SWR or Server Components, not hand-written Redux slices.
- URL state: filters, sort, page, selected tab if shareable. Survives refresh, back button and sharing.
- Local UI state: open/closed, hover, input text:
useStatein the component that uses it. - Form state: react-hook-form or React 19 Actions.
- Shared client state (cart before checkout, theme, wizard progress): Context for low-frequency values; Zustand or Redux Toolkit for frequent updates and many readers.
- Pick the smallest tool per category and name migration triggers (many cross-cutting updates, need for devtools/time travel, team size, performance problems).
- Cross-tab sync: the
storageevent orBroadcastChannel. - Team disagreement ("we want Redux"): agree on criteria, prototype both on one feature, write an ADR, revisit later.
The red pen
Common traps: mistake → fix
Mistake: "Put everything in one global store"
Fix: server data becomes stale copies with no invalidation story.
Mistake: "Redux is dead" or "Redux always"
Fix: both are dogma; argue from requirements.
Mistake: "Context is a state management library"
Fix: it is transport; the state lives somewhere else.
Easy to hard
Questions interviewers ask, easy to hard
- Product list with filters, cart, signed-in user, live order status: how would you manage state?
- Which of these is server state, client state, URL state, form state?
- What would make you move from Context to Zustand or Redux?
- How do you keep the cart in sync across tabs?
- Your team wants Redux and you think it is overkill. How do you handle it?
Practise
Practise with these questions
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.