Zustand

Minimal React state management library with a hooks-based API, no Provider wrapper required, supporting slice pattern for modular state, and middleware for persistence, devtools, and immer-based immutable updates.

Evaluated Mar 06, 2026 (0d ago) v5.x
Homepage ↗ Repo ↗ Developer Tools react state-management flux hooks lightweight typescript middleware
⚙ Agent Friendliness
68
/ 100
Can an agent use this?
🔒 Security
29
/ 100
Is it safe for agents?
⚡ Reliability
63
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
82
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
0
Auth Strength
0
Scope Granularity
0
Dep. Hygiene
90
Secret Handling
78

No network security surface. Sensitive state (tokens, PII) stored via persist middleware writes to localStorage in plaintext — avoid persisting secrets or sanitize before persist.

⚡ Reliability

Uptime/SLA
0
Version Stability
88
Breaking Changes
80
Error Recovery
85
AF Security Reliability

Best When

Managing client-side UI state in React applications where Redux Toolkit feels like overkill and you want minimal boilerplate with TypeScript support and tiny bundle size (~1KB).

Avoid When

Your state is primarily server-derived data that needs caching and synchronization — TanStack Query or Apollo Client are better fits for that pattern.

Use Cases

  • Create a global store for UI state (user session, theme, modals) with a single create() call and use it in any component without a Provider
  • Implement the slice pattern to split a large store into domain-specific slices (authSlice, cartSlice) that compose into one store
  • Persist store state to localStorage using the persist middleware with automatic rehydration on page load
  • Use subscribeWithSelector middleware to subscribe to fine-grained store slices from outside React (e.g., in a service or event handler)
  • Integrate immer middleware for complex nested state mutations using mutable syntax while keeping the store immutable under the hood

Not For

  • Server state management (API fetching, caching, background sync) — use TanStack Query for that
  • Applications needing strict Redux-style action dispatching with time-travel debugging via Redux DevTools (though Zustand devtools middleware exists)
  • Teams that need the formal reducer/action/selector pattern for large-scale state architecture

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No auth layer — Zustand is a client-side state library. Auth state is commonly stored in a Zustand store but auth logic is external.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

MIT licensed. Maintained by Poimandres open source collective.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Zustand v5 removed the deprecated get() argument from set() — code using set((state) => ...) is fine but set(get => ...) syntax from older tutorials will break
  • Selectors passed to useStore must be stable references or wrapped in useShallow; inline selector functions cause infinite re-renders on every state change
  • The persist middleware stores state as JSON; class instances, Maps, Sets, and non-serializable values will be lost on rehydration and must be handled in the onRehydrateStorage callback
  • Zustand stores created with create() are module-level singletons; in test environments, always reset the store between tests or state leaks between test cases
  • Accessing store state outside React components via getState() returns a snapshot and does not subscribe to updates — use subscribe() for reactive non-React listeners

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Zustand.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered