Reference
API-first reference for stores, hooks, middlewares, and integrations.
APIs
Core functions for creating and configuring stores.
create— Create a store bound to React via hooks.createStore— Create a standalone store without React.createWithEqualityFn— Likecreate, but with a custom equality function.shallow— Utility for shallow comparison of objects and arrays.
Hooks
React hooks for reading and subscribing to store state.
useStore— Access and subscribe to a vanilla store from a React component.useStoreWithEqualityFn— LikeuseStore, but with a custom equality function.useShallow— Derive a stable reference from a selector using shallow comparison.
Middlewares
Composable middleware functions for extending store behavior.
persist— Persist and rehydrate state usinglocalStorageor a custom storage engine.devtools— Connect a store to Redux DevTools for time-travel debugging.redux— Use a reducer and dispatch pattern similar to Redux.immer— Write state updates with mutable syntax using Immer.combine— Combine separate state slices into a single store with inferred types.subscribeWithSelector— Subscribe to a slice of state with selector and equality support.
Integrations
In-depth guides for using Zustand alongside third-party libraries.
- Persisting store data — Detailed guide to the
persistmiddleware and storage adapters. - Immer middleware — Detailed guide to the
immermiddleware. - Third-party libraries — Using Zustand with other libraries in the ecosystem.
Migrations
Upgrade guides between major versions.
- Migrating to v5 — How to upgrade from Zustand v4.
- Migrating to v4 — How to upgrade from Zustand v3.
Previous versions
APIs that existed in older versions of Zustand and are no longer recommended for new code.
- createContext (v3) — The
createContextexport fromzustand/context, deprecated in v4 and removed in v5.