State management ecosystem map
React applications do not have one kind of state.
The most important question is not:
Which state library is best?
It is:
What kind of state is this, who owns it, how long should it live, and who needs to subscribe to it?
This chapter is the map for the ecosystem sections that follow.
Version snapshotโ
This handbook currently targets these stable package lines:
| Tool | Stable line | Primary purpose |
|---|---|---|
| React | 19.2 docs line | UI/state primitives and rendering model |
| Redux Toolkit | 2.12.0 | structured shared client state and app-wide state transitions |
| Zustand | 5.0.14 | lightweight external store with selector subscriptions |
| TanStack Query | 5.101.4 | server-state fetching, caching, synchronization, and mutations |
| React Hook Form | 7.82.0 | form values, validation, form metadata, and submission workflows |
React Hook Form 8 is still beta at this audit point, so v7 remains the production baseline.
Always re-check package releases before copying version-sensitive APIs into production.
The state taxonomyโ
Different categories can coexist without competing for ownership.
useState / useReducer
lifted state / Context / reducer + Context
Redux Toolkit / Zustand
TanStack Query
React Hook Form
URL / router
These categories can work together in the same application.
Local UI stateโ
Use local state for values whose lifetime and ownership are naturally local.
function Dialog() {
const [open, setOpen] = useState(false)
return (
<>
<button onClick={() => setOpen(true)}>Open</button>
{open && <Modal onClose={() => setOpen(false)} />}
</>
)
}
Examples:
- dialog visibility;
- accordion state;
- unsaved input draft;
- selected row;
- hover/focus coordination;
- local wizard step.
Do not move state into a global store only because two descendants may eventually need it.
Shared subtree state: Contextโ
Context is best understood as a tree-scoped distribution mechanism.
Makes cart state available only to the subtree that needs it.
Reads cart information without prop drilling.
Reads the same provider value deeper in the tree.
The provider makes a value available to descendants without forwarding that value through every intermediate component.
Context does not itself create state.
Owns the state and defines how it changes.
Distributes access to descendants.
Uses the value without prop drilling.
Use Context when the value represents a subtree-wide environment or feature dependency such as:
- theme;
- locale;
- session metadata;
- feature permissions;
- cart state for a storefront subtree;
- reducer state/dispatch for one feature.
Structured shared client state: Redux Toolkitโ
Redux Toolkit is appropriate when state transitions, traceability, tooling, middleware, normalized state, and predictable cross-feature ownership matter.
Redux is not automatically the right place for:
- every input value;
- every modal;
- raw API cache data;
- temporary component state.
Lightweight external client state: Zustandโ
Zustand provides a store outside React with selector-based subscriptions.
cart + userPreferences + named actions
Use it when you want:
- an external store;
- low ceremony;
- independent selector subscriptions;
- state access outside React;
- middleware such as persistence/devtools;
- multiple stores with focused ownership.
A small API does not remove the need for architecture.
Server state: TanStack Queryโ
Server state is different because the client is not authoritative.
['products'] ยท ['user', 42] ยท ['orders', filters]
Server state involves concerns such as:
- freshness;
- caching;
- stale data;
- refetching;
- retries;
- invalidation;
- pagination;
- optimistic mutations;
- background synchronization.
TanStack Query is not just another Redux replacement. It solves a different lifecycle problem.
Form state: React Hook Formโ
A complex form has its own state model:
React Hook Form focuses on forms rather than general application state.
Do not put an entire form into Redux or Zustand by default merely because it has many fields.
URL stateโ
State belongs in the URL when users should be able to refresh, bookmark, share, or navigate through it.
/products?category=lights&sort=price&page=2
Candidates include:
- search query;
- filters;
- page number;
- selected resource ID;
- route-level tab;
- sort order.
Duplicating URL state into a client store creates synchronization work and can produce competing sources of truth.
One application can use several toolsโ
A mature application might intentionally use all of these:
This is not duplication when each tool owns a distinct category.
Decision questionsโ
For each value, ask:
- What is the authoritative source?
- Who writes it?
- Who reads it?
- How long should it live?
- How frequently does it update?
- Does it need independent subscriptions?
- Does it come from a server?
- Should users be able to share it in a URL?
- Is it specifically form lifecycle state?
- Must non-React code access it?
Common architecture mistake: one global bucketโ
Server responses + dialog state + form drafts + URL params + theme + notifications + everything else.
Synchronization bugs, broad updates, hard migrations, unclear persistence, and accidental coupling.
Better:
Interview questionsโ
Junior: What is the difference between local state and shared state?
Mid-level: Why is TanStack Query not equivalent to Redux or Zustand?
Senior: How do source of truth, lifetime, update frequency, and subscriber granularity affect state architecture?
Staff: How would you migrate a large application away from a single universal store without creating duplicate ownership during the transition?