The State Management Landscape Has Shifted
Redux dominated React state management for years. Today, the ecosystem has fragmented into specialized solutions, each optimized for different types of state. The key insight: not all state is the same, and different state deserves different treatment.
Understanding state categories is the first step to choosing the right tool.
The Four Categories of State
Server State: Data from your API. This is not really "your" state - it is a cache of someone else's state. It needs synchronization, background refetching, optimistic updates, and cache invalidation. TanStack Query (React Query) and SWR handle this brilliantly.
Global UI State: Application-wide concerns like authentication status, theme preferences, feature flags, and notification queues. Shared across many components but changes infrequently. Zustand, Jotai, or even React Context work well here.
Local UI State: Component-specific state like form inputs, modal open/closed, accordion expanded/collapsed. useState and useReducer are perfectly adequate. Do not over-engineer this.
URL State: Filters, pagination, search queries, selected tabs. This state should survive page refreshes and be shareable via links. useSearchParams or dedicated URL state libraries manage this.
Signals: The New Paradigm
Signals represent a fundamental shift in reactivity. Unlike React's top-down re-rendering model, signals provide fine-grained reactivity - only the specific DOM nodes that depend on changed values update.
Solid.js pioneered this approach, and now signals are appearing everywhere: Preact Signals, Angular Signals, and proposals for React itself.
The appeal: automatic dependency tracking, no stale closure bugs, no unnecessary re-renders, and simpler mental models for derived state.
Zustand: Simple Global State
Zustand provides a minimal, hooks-based API for global state without Redux's boilerplate. Create a store, export hooks, use them in components. No providers, no context, no ceremony.
Features that matter:
Jotai: Atomic State
Jotai takes the atomic approach - state as independent atoms that can be combined and derived. This bottom-up model fits well with component composition.
Atoms are created outside components and can be shared across the app. Derived atoms automatically update when their dependencies change. The mental model closely matches how you think about data relationships.
Making the Right Choice
Start with the simplest option that meets your needs:
Only reach for more complex solutions when simpler ones fail. Most applications need far less global state than developers initially assume.
Best Practices
Recommended Reading
💬Discussion
No comments yet
Be the first to share your thoughts!
