State Management Architecture
Choosing the right state tool for the right job. Server state with TanStack Query, client state with Zustand, atomic state, Redux Toolkit, and the decision framework for when each wins.
The 5 categories of frontend state, why 'just use Redux' is dead, and a decision framework that prevents you from picking the wrong tool ever again.
Why server state is fundamentally different from client state, and how TanStack Query v5 handles caching, deduplication, background refetching, optimistic updates, and infinite queries — replacing 90% of what Redux was used for.
Zustand's minimal API, selector-based re-render optimization, slices pattern for large stores, middleware system, and when to choose it over Context API.
Jotai's bottom-up, atom-based state model — primitive, derived, and async atoms, atom families, Suspense integration, and when atomic state beats top-down stores.
Redux Toolkit's modern API — createSlice, createAsyncThunk, RTK Query — when Redux still makes sense, when it's overkill, and the evolution from verbose Redux to a streamlined toolkit.
Using the URL as your state manager — searchParams for filters, pagination, and sort, nuqs for type-safe URL state, shallow routing, and why URL state beats React state for shareable views.
React Hook Form's uncontrolled-first philosophy, register vs Controller, Zod validation, field arrays, and why it's 10x faster than controlled form libraries for complex forms.
Finite state machines and statecharts with XState v5 — states, events, transitions, guards, actions, actors, and why state machines eliminate entire categories of bugs in complex UI flows.
Update UI before the server confirms — optimistic updates with TanStack Query, Zustand, and React 19's useOptimistic. Error recovery, rollback strategies, and when NOT to be optimistic.
WebSocket and SSE integration with state libraries, CRDTs for conflict-free collaborative editing, Yjs and Automerge, presence systems, and scaling considerations for real-time apps.
Test your state management architecture knowledge — 10 questions covering state categories, TanStack Query, Zustand, URL state, optimistic updates, XState, and real-time patterns.