State Management — Senior Interview Prep
Modern frontend state is two problems, not one: server state (a cache of remote data) and client state (UI state you own). Get that split right and most “which library?” debates resolve themselves. This folder covers the framing, the modern client stores, and the Redux ecosystem.
Start here
Client-state libraries
| Library | File |
|---|---|
| Zustand (single store) | Zustand |
| Jotai (atomic) + Valtio (proxy) | Jotai and Valtio |
| MobX (observable) | MobX |
| Redux core, middleware, selectors | Redux |
Server-state libraries
| Library | File |
|---|---|
| RTK Query (Redux-integrated) | RTK Query |
| TanStack Query (standalone) | TanStack Query — Cache Keys, Invalidation, Prefetch |
Redux deep-dive (existing files)
redux core · Redux Toolkit · middleware · sync vs async middleware · selectors · reselect · dispatch · mapStateToProps · mapDispatchToProps
How an interviewer probes state management
- “How do you decide where state lives?” — server vs client split, then colocation. See Server State vs Client State.
- “Why not just put everything in Redux?” — reimplements caching; boilerplate cost. See Choosing a State Library.
- “How does cache invalidation work in RTK Query / TanStack Query?” — tags vs
invalidateQueries. See RTK Query. - “Zustand re-renders too much — why?” — selector returning a fresh object without shallow equality. See Zustand.
Cross-references
- React Context performance: Context Performance Traps
- Data fetching and caching: APIs & Data Fetching — Senior Interview Prep
- Vue state (Pinia/Vuex): Pinia (and Where Vuex Still Appears)