Skip to main content

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:

ToolStable linePrimary purpose
React19.2 docs lineUI/state primitives and rendering model
Redux Toolkit2.12.0structured shared client state and app-wide state transitions
Zustand5.0.14lightweight external store with selector subscriptions
TanStack Query5.101.4server-state fetching, caching, synchronization, and mutations
React Hook Form7.82.0form 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โ€‹

React state taxonomyClassify ownership before choosing a library.
React application

Different categories can coexist without competing for ownership.

React-ownedLocal UI state

useState / useReducer

Tree-scopedShared React-owned state

lifted state / Context / reducer + Context

External storeShared client state

Redux Toolkit / Zustand

Remote authorityServer state

TanStack Query

Workflow draftForm state

React Hook Form

ShareableNavigation state

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.

Context follows the provider tree
CartProvider

Makes cart state available only to the subtree that needs it.

Header โ†’ CartCount

Reads cart information without prop drilling.

Shop โ†’ CartDrawer

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.

Ownership vs distribution
useState / useReducer

Owns the state and defines how it changes.

Context

Distributes access to descendants.

Component subtree

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 Toolkit event flow
UI event
A user or system event triggers an action.
Redux Toolkit store
Central external store receives the event.
New store state
Immutable next state becomes authoritative.
Subscribed components
Only selector consumers whose result changed need to update.

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.

Zustand selector subscriptions
Zustand store

cart + userPreferences + named actions

CartBadge
Selects only cart-derived state.
SettingsPanel
Selects only preferences.

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.

Server state cache ownership
Database / API
Authoritative remote data source.
QueryClient cache

['products'] ยท ['user', 42] ยท ['orders', filters]

React UI
Receives pending, error, fresh, stale, and updated data states.

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 owns the form workflow
useForm()
Creates the form control and subscription model.
Field values
Current local draft values.
Validation + errors
Field and form validation results.
Dirty + touched
Interaction and change metadata.
Submission state
Pending / submitted / success lifecycle.
Dynamic fields
Arrays and conditional form structure.
Subscriptions
Components observe only what they need.

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:

One application, multiple ownersThe architecture is healthy when each tool owns a distinct category.
E-commerce application
Different lifecycles are intentionally separated.
useState
Open cart drawer.
Context
Currency / locale.
Redux Toolkit
Long-lived checkout workflow.
Zustand
Design/editor interaction state.
TanStack Query
Products / inventory / orders.
React Hook Form
Shipping and billing form.
URL
Search / filters / pagination.

This is not duplication when each tool owns a distinct category.

Decision questionsโ€‹

For each value, ask:

  1. What is the authoritative source?
  2. Who writes it?
  3. Who reads it?
  4. How long should it live?
  5. How frequently does it update?
  6. Does it need independent subscriptions?
  7. Does it come from a server?
  8. Should users be able to share it in a URL?
  9. Is it specifically form lifecycle state?
  10. Must non-React code access it?

Common architecture mistake: one global bucketโ€‹

Anti-pattern: one universal global bucket
GlobalStore

Server responses + dialog state + form drafts + URL params + theme + notifications + everything else.

Symptoms

Synchronization bugs, broad updates, hard migrations, unclear persistence, and accidental coupling.

Better:

Better decision flow
1 ยท Classify state
2 ยท Choose source of truth
3 ยท Define scope + lifetime
4 ยท Define subscription model
5 ยท Choose the smallest fitting tool
Fast first-pass state decision
Only local UI interaction?useState / useReducer
Shared subtree dependency?Context
Structured shared client state?Redux Toolkit / Zustand
Remote authoritative data?TanStack Query
Complex form lifecycle?React Hook Form
Bookmarkable/shareable navigation state?URL / router

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?

Referencesโ€‹