Skip to content
Sahil Durgia/ full-stack
2 min readReact

State Management in React: Context API vs Redux Toolkit vs Zustand vs TanStack Query

Four tools all called 'state management,' solving three genuinely different problems — most complaints come from using the wrong one for the job.

Reactstate managementRedux

"What should I use for state management" is a poorly formed question, because "state" in a real app is at least three different things with different actual requirements. Most of the complaints about each of these tools come from using them for the wrong kind of state, not from the tool being bad.

The three kinds of state, actually

  • Local UI state — is this dropdown open, what's currently typed in this field. Lives and dies with one component. useState is correct, full stop; reaching for a global store here is solving a problem you don't have.
  • Global client state — the logged-in user, a shopping cart, a UI theme. Shared across distant parts of the tree, changes based on user action, has no server-side source of truth to sync against.
  • Server (cache) state — data that actually lives in a database, fetched over the network, that can go stale and needs re-fetching, deduping, and cache invalidation. This is NOT the same problem as global client state, even though it's tempting to shove API responses into the same store.

Where each tool actually fits

  • Context API — built into React, no library needed. Good for global client state that changes infrequently (theme, current user). Genuinely bad for state that changes often, because every consumer of a context re-renders on any change to it — there's no built-in selective subscription.
  • Redux Toolkit — the modern, opinionated version of Redux, with far less boilerplate than classic Redux. Earns its complexity when global client state is genuinely complex: many interrelated pieces of state, non-trivial update logic, and a real need for the predictability of one centralized store with a strict update pattern.
  • Zustand — a minimal global-state library with none of Redux's ceremony (no action types, no reducers, no providers). The right choice when you want global client state that's simpler than Redux's ceremony justifies, without falling back to Context's re-render-everything problem.
  • TanStack Query — solves the server-state problem specifically: caching, deduping identical in-flight requests, background refetching, stale-time control. It is not a Redux replacement; it's solving a different problem that Redux was never actually good at.

The practical takeaway

A well-architected React app frequently uses more than one of these at once, deliberately: TanStack Query for server data, Zustand or Context for the small amount of genuine global client state left over, and useState for everything local. Reaching for one tool to solve all three kinds of state is the actual root of most "state management is too complicated" complaints.

Keep reading
Next: Server Components vs Client Components

Part 10 of the why-React series.