zustand
Use when managing client-side state with Zustand — global stores, slices, middleware, or persistence. Also use when choosing between state management solutions or migrating from Redux/Context to Zustand.
| Model | Source |
|---|---|
| sonnet | pack: state |
Full Reference
┏━ 🔧 zustand ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when managing client-side state with Zusta… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Zustand
Section titled “Zustand”Minimal, unopinionated state management for React. No providers, no reducers, no ceremony — just a store hook with selector-based subscriptions. v5.0.x requires React 18+ and TypeScript 4.5+.
Quick Reference
Section titled “Quick Reference”| Item | Value |
|---|---|
| Install | npm install zustand |
| Version | 5.0.11 |
| Key imports | create from zustand, persist, devtools, immer from zustand/middleware |
| Docs | https://zustand.docs.pmnd.rs |
Reference Index
Section titled “Reference Index”| I want to… | File |
|---|---|
| Install Zustand, create a store, or write async actions | reference/setup.md |
| Subscribe to state with selectors, useShallow, or outside React | reference/stores.md |
| Define actions, understand set vs replace, or migrate from Redux/Context | reference/actions.md |
| Persist state with middleware, swap storage adapters, or handle SSR hydration | reference/persistence.md |
| Use devtools middleware, write tests, or reset stores between tests | reference/devtools.md |
| Split into slices, stack middleware, or use immer for nested updates | reference/slices.md |
Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.