Skip to main content

State architecture visual mental model

Senior React state management starts by classifying what kind of state you have, not by picking a library.

State categories in a React application
Local UI state

modal open · active tab · hover/selection · local draft

Shared client state

coordinated workflow state shared across a feature or app boundary

Server state

remote records, cache freshness, invalidation, retries, pagination

URL state

route · filter · sort · page · shareable navigation choices

External state

browser APIs · third-party stores · subscription-driven sources

Derived data

values calculated from current authoritative inputs

Choose one owner per fact​

Ownership prevents synchronization bugs
One authoritative fact
One correct source of truth
derive
display
subscribe

The danger begins when several layers independently mutate copies of the same fact.

State scope ladder​

Escalate ownership only as far as necessary
One component

keep state local

Closest common parent

lift state

Context / reducer + Context

subtree distribution and shared feature ownership

External client store

Redux Toolkit · Zustand · other deliberately chosen store

Server state is a different lifecycle​

Why remote data is not just another useState value
Client-owned state

Your UI is authoritative for the current value and transition rules.

Server-owned state

The server remains authoritative; the client holds snapshots with freshness, retry, invalidation, and synchronization concerns.

URL state deserves first-class ownership​

Shareable navigation choices belong in the URL
URL

?page=2&sort=price

Filters UI
Results
Back/forward & sharing

Avoid a second synchronized copy in component or global state unless there is a clear lifecycle reason.

External stores and useSyncExternalStore​

React integrates with an external source through a subscription contract
External store / browser source
useSyncExternalStore
Component renders
Where should this state live?
Can it be calculated now?Derived value — do not store another copy
Only one local subtree needs it?Local state / reducer
Shared across a subtree?Lift state or Context
High-frequency shared client state with selective subscriptions?External store may fit
Owned by a remote API/database?Server-state architecture
Should survive refresh/share/back-forward?URL

Architecture rule​

Classify before choosing a tool
Classify
Choose owner
Define lifetime
Define consumers
Choose smallest fitting tool

Continue with State Categories and useSyncExternalStore before moving into the ecosystem-specific sections 16A–16F.