zustand
5.0.16 · 22 Oct 2026MIT87.8M / weekRepositorynpmAtom feed
4.5.7 is the newest release of 4.x.
In short
8 breaking3 new13 fixed3 internal
- breaking
vanilla: Drop deprecated store.subscribe with selector
- breaking
middleware: Drop deprecated persist options and make removeItem required
- breaking
core: Drop v2 hook compatibility
- breaking
types: Drop deprecated UseStore type
- breaking
middleware/devtools: Use official devtools extension types
- breaking
middleware/devtools: Remove deprecations and warnings
- breaking
types: Add higher kinded mutator types
- breaking
middleware/devtools: Remove checking old string option
Release note
Zustand v4 is here
Backward compatible with v3 in JS
v4 API is completely backward compatible, so it's just nothing to update if you are JS users.
One note is v4 depends on use-sync-external-store.
There might be some bundling issues.
Please report them if you encounter such cases.
TypeScript types are rewritten
To better support types with middleware, v4 TypeScript code is rewritten.
Please find docs/typescript.md for more information.
New API for context usage
In v3, zustand/context is provided as a workaround.
v4 API exposes createStore and useStore, which are more flexible.
Please read this for usage.
If you are unsure about the usage, open a new discussion.
Counter example: codesandbox.io/s/polished-pond-4jn1e2
Deprecated APIs are removed
Some APIs are already deprecated in v3, and they are removed in v4. Please make sure to update to the latest version of v3 before migrating to v4.
What's Changed
- breaking
vanilla: Drop deprecated store.subscribe with selector
- breaking
middleware: Drop deprecated persist options and make removeItem required
- breaking
core: Drop v2 hook compatibility
- breaking
types: Drop deprecated UseStore type
use-sync-external-store
- breaking
middleware/devtools: Use official devtools extension types
- breaking
middleware/devtools: Remove deprecations and warnings
build: Separate vanilla build
- breaking
types: Add higher kinded mutator types
index: Export createStore from vanilla
middleware: Separate immer middleware
middleware/devtools: Add
enabledoption and show devtools warning only if enabled- breaking
middleware/devtools: Remove checking old string option
Fix TS4023 and other minor changes
types: Avoid any in react.ts
build: Add downlevel-dts
types: Mark more methods bivariant
shallow: Restrict types
persist: Add method getOptions on persist api and update documentation
types: Minimize types by deprecating them
build: A workaround for ESM for use-sync-external-store
types: Use TS interfaces only for public api
shallow: Types with useStore
shallow: Types with useStore again