Skip to content

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.

ModelSource
sonnetpack: state
Full Reference

┏━ 🔧 zustand ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when managing client-side state with Zusta… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

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+.

ItemValue
Installnpm install zustand
Version5.0.11
Key importscreate from zustand, persist, devtools, immer from zustand/middleware
Docshttps://zustand.docs.pmnd.rs
I want to…File
Install Zustand, create a store, or write async actionsreference/setup.md
Subscribe to state with selectors, useShallow, or outside Reactreference/stores.md
Define actions, understand set vs replace, or migrate from Redux/Contextreference/actions.md
Persist state with middleware, swap storage adapters, or handle SSR hydrationreference/persistence.md
Use devtools middleware, write tests, or reset stores between testsreference/devtools.md
Split into slices, stack middleware, or use immer for nested updatesreference/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.