zustand
5.0.16 · 22 Oct 2026MIT87.8M / weekRepositorynpmAtom feed
124 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 5.x · latest line
5.0.16
22 Oct 2026react: Don't memoize getServerSnapshot in useStore
devtools: Apply serialize.reviver when parsing devtools messages
devtools: Preserve shared connections during store cleanup
This version has some improvements thanks to contributors: @MarshallOfSound @koreahghg @chungyo @Godsdar
What's Changed
react: Don't memoize getServerSnapshot in useStore
devtools: Apply serialize.reviver when parsing devtools messages
devtools: Preserve shared connections during store cleanup
persist: Preserve external devtools action arguments
5.0.15
13 Aug 2026devtools: Correct V8 stack regex when source path contains spaces
persist: clearStorage() should invalidate concurrent async rehydration
Fix some issues in devtools and persist middleware.
What's Changed
devtools: Correct V8 stack regex when source path contains spaces
persist: clearStorage() should invalidate concurrent async rehydration
5.0.14
28 May 2026devtools: Improve type inference for Devtools initializer
This release fixes a type issue in devtools.
What's Changed
devtools: Improve type inference for Devtools initializer
5.0.13
5 May 2026devtools: Support Firefox/Safari stack format in findCallerName
This release includes an improvement in the devtools middleware.
What's Changed
devtools: Support Firefox/Safari stack format in findCallerName
5.0.12
16 Mar 2026persist: Use latest state in post-rehydration callback
devtools: Correct redux devtools config type extension
Two small fixes.
What's Changed
persist: Use latest state in post-rehydration callback
devtools: Correct redux devtools config type extension
5.0.11
1 Feb 2026persist: Avoid relying on global localStorage
immer: Proper typing for immer middleware in combination with slices
This release includes small improvements in middleware thanks to contributors.
What's Changed
persist: Avoid relying on global localStorage
immer: Proper typing for immer middleware in combination with slices
5.0.10
12 Jan 2026persist: Prevent race condition during concurrent rehydrate calls
This version includes a fix to the
persistmiddleware for an edge case.What's Changed
persist: Prevent race condition during concurrent rehydrate calls
5.0.9
30 Nov 2025experimental: Unstable ssrSafe middleware
This includes experimental middleware
unstable_ssrSafefor a new usage with Next.js.
Related discussion: github.com/pmndrs/zustand/discussions/2740What's Changed
experimental: Unstable ssrSafe middleware
5.0.8
19 Aug 2025shallow: Undefined value
middleare/persist: Return storage promise from setState
A bug fix in
shallowand a tiny improvement inpersist.What's Changed
shallow: Undefined value
middleare/persist: Return storage promise from setState
5.0.7
31 Jul 2025react: useCallback for getSnapshot
This enables a small optimization in some edge cases.
What's Changed
react: useCallback for getSnapshot
5.0.6
26 Jun 2025devtools: Avoid inferring action type when explicit action name is provided
Some very minor changes.
What's Changed
devtools: Avoid inferring action type when explicit action name is provided
5.0.5
21 May 2025vanilla: Update shallow compare function and tests
Add devtools.cleanup() method
devtool: Inferred action type
It comes with some small improvements.
What's Changed
vanilla: Update shallow compare function and tests
Add devtools.cleanup() method
devtool: Inferred action type
5.0.4
1 May 2025package: react-native condition
This fixes module resolution issue for React Native users.
What's Changed
package: react-native condition
5.0.3
7 Jan 2025types: Make ExtractState public
build: Alias entries in rollup config
ExtractStateis a type util to extract state type from store type.What's Changed
types: Make ExtractState public
build: Alias entries in rollup config
5.0.1
30 Oct 2024shallow: Fallback map-like iterator comparison
shallow: iterable-like insensitive keys order comparison (alternate implementation)
This fixes
shallowfunction for some edge cases.What's Changed
shallow: Fallback map-like iterator comparison
shallow: iterable-like insensitive keys order comparison (alternate implementation)
5.0.0
14 Oct 2024- removed
Drop default exports
- removed
Drop deprecated features
- breaking
Make React 18 the minimum required version
Zustand v5
TL;DR
No new features
Drop many old things
Migration from v4 should be smooth.
Changes in v5
- removed
Drop default exports
- removed
Drop deprecated features
- breaking
Make React 18 the minimum required version
Make use-sync-external-store a peer dependency (required for
createWithEqualityFnanduseStoreWithEqualityFninzustand/traditional)- breaking
Make TypeScript 4.5 the minimum required version
Drop UMD/SystemJS support
Organize entry points in the package.json
Drop ES5 support
Stricter types when setState's replace flag is set
Persist middleware behavioral change
Other small improvements (technically breaking changes)
Migration Guide
Read the migration guide carefully:
github.com/pmndrs/zustand/blob/main/docs/migrat…Frequently Reported Issue
During the RC period, some users encountered the following infinite loop error:
Uncaught Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.
This case was already a non-ideal behavior in v4 but appears more explicitly as an error in v5. While there are several ways to resolve this, using
useShallowoften fixes the problem.What's Changed
v5
Fix Immer type inference for
setState
- 4.x
4.5.6
7 Jan 2025See
4.5.5
15 Aug 2024storage: Avoid calling setItem with the state just retrieved
This improves the
persistmiddleware behavior for an edge case.:warning: We thought this was fixing a bug, but it actually introduced a behavioral breaking change. Please use v4.5.4 if the change is troublesome. See
What's Changed
storage: Avoid calling setItem with the state just retrieved
4.5.4
26 Jun 2024No type field in package.json
There was an issue in v4.5.3 with some bundlers.
What's Changed
No type field in package.json
4.5.3
26 Jun 2024Migrate to pnpm
useStore uses ReadonlyStoreApi
It comes with a minor fix in types, but also some changes in configs.
What's Changed
Migrate to pnpm
useStore uses ReadonlyStoreApi
4.5.2
2 Mar 2024Return type of persist migrate function changed to PersistedState
It should improve the compatibility with old browsers.
What's Changed
Return type of persist migrate function changed to PersistedState
4.5.1
17 Feb 2024Relax types for
persistmiddleware
People might have misunderstood with
useStoredeprecation message. Hope this mitigates it.What's Changed
Relax types for
persistmiddleware
4.5.0
20 Jan 2024getInitialState
Add deprecation notice for getServerState() in WithReact type
This version adds a new capability for SSR/Hydration.
What's Changed
getInitialState
Add deprecation notice for getServerState() in WithReact type
4.4.7
28 Nov 2023vanilla: Unexpected null state update behavior
There's a small fix for a use case with an non-object value in store.
What's Changed
vanilla: Unexpected null state update behavior
4.4.6
2 Nov 2023Update export types
v4.4.5 has an issue with some TypeScript configs about module resolution. It should be fixed now. Thanks for the patience.
What's Changed
Update export types
4.4.5
31 Oct 2023Importing CJS React in ESM
Apply publint recommendations
Hopefully, it should fix some issues with Node.js environment including Next.js.
What's Changed
Importing CJS React in ESM
Apply publint recommendations
4.4.4
21 Oct 2023build: Patch entry points zustand/shallow for CJS
There was a tiny issue in v4.4.3, which broke with some bundlers, which this version fixes.
What's Changed
build: Patch entry points zustand/shallow for CJS
4.4.3
5 Oct 2023shallow: Extract shallow vanilla and react
types: Mitigate devtools typing
The changes in v4.4.2 were troublesome for some users. This version should fix/mitigate such cases.
What's Changed
shallow: Extract shallow vanilla and react
types: Mitigate devtools typing
4.4.2
2 Oct 2023fix(types)(middleware/devtools): avoid copying types
traditional: Make defaultEqualityFn optional in TS Types
Add useShallow
This adds
useShallowhook to cover some use cases that are deprecated with v4.4.0 change. Check out the guide.Migration Guide
#1991 requires something like below if you are using the
devtoolsmiddleware and TypeScript.import { devtools } from 'zustand/middleware' + import type {} from '@redux-devtools/extension'What's Changed
fix(types)(middleware/devtools): avoid copying types
traditional: Make defaultEqualityFn optional in TS Types
Add useShallow
4.4.1
6 Aug 2023- deprecated
Improve warning for deprecated equalityFn
types: Accept undefined equalityFn for the deprecated useStore
Fixes some issues reported with the deprecated feature in v4.4.0.
What's Changed
types: Accept undefined equalityFn for the deprecated useStore
- deprecated
Improve warning for deprecated equalityFn
4.4.0
1 Aug 2023- deprecated
Deprecate equalityFn and add createWithEqualityFn
Declare @types/react as peerDep to avoid phantom dep
This adds new
zustand/traditionalentry point and deprecates equalityFn fromzustand.Migration Guide
If you don't use custom
equalityFn, nothing is required.For those who use custom equalityFn such as
shallow:// previously import { create } from 'zustand' const useFooStore = create((set) => ...) // now import { createWithEqualityFn } from 'zustand/traditional' const useFooStore = createWithEqualityFn((set) => ..., Object.is) // Object.is is the default quailtyFn in zustand create; to match that behavior, pass that function here. This can be updated to shallow or anything elseWhat's Changed
- deprecated
Deprecate equalityFn and add createWithEqualityFn
Declare @types/react as peerDep to avoid phantom dep
4.3.9
4 Jul 2023build: Mode env for "import" condition"
This includes a small improvement for production build mostly for Vite users. Docs have been improved too!
What's Changed
build: Mode env for "import" condition"
4.3.8
4 May 2023middleware/persist: Improve createJSONStorage for Maps
For persist middleware, a new option for createJSONStorage in introduced to support more cases. Note that createJSONStorage isn't a required function (and it's not very recommended as it's not type safe), and one should create a custom storage for more use cases.
What's Changed
middleware/persist: Improve createJSONStorage for Maps
4.3.7
31 Mar 2023middleware/persist: Add skip hydration option #405
middleware/persist: Ensure
persistdoes not drop updates inonRehydrateStoragewhen using a synchronous storage APImiddleware/persist: Ensure argument for
onRehydrateStorageandonHydrateis defined on first hydration
This includes a couple of improvements in
persistmiddleware.What's Changed
middleware/persist: Add skip hydration option #405
middleware/persist: Ensure
persistdoes not drop updates inonRehydrateStoragewhen using a synchronous storage APImiddleware/persist: Ensure argument for
onRehydrateStorageandonHydrateis defined on first hydration
4.3.6
6 Mar 2023react, types: Relax react types
This has a little improvement for library authors.
What's Changed
react, types: Relax react types
4.3.5
28 Feb 2023build: re-export createStore from index
v4.3.4 has a regression in CJS build. Please use this version instead.
What's Changed
build: re-export createStore from index
4.3.4
27 Feb 2023build: UMD names
build: Possibly improve ESM for production build
build: Add explicit export paths for cjs
This version fixes some build configs for some edge cases.
⚠️ this version has an issue in CJS build. Please use v4.3.5.
What's Changed
build: UMD names
build: Possibly improve ESM for production build
build: Add explicit export paths for cjs
4.3.3
10 Feb 2023build: Improve patch scripts
log: Deprecated messages copyedit for consistency
build: Reorder the types field in package.json
This version includes some small fixes and internal improvements.
What's Changed
build: Improve patch scripts
log: Deprecated messages copyedit for consistency
build: Reorder the types field in package.json
4.3.2
14 Jan 2023vanilla,shallow: Default export regression in CJS
middleware/persist: Fix the storage type
There was a regression with default export (which is deprecated) in v4.3.0 and v4.3.1. This should fix it.
What's Changed
vanilla,shallow: Default export regression in CJS
middleware/persist: Fix the storage type
4.3.1
10 Jan 2023This version supersedes v4.3.0.
This version supersedes v4.3.0.
4.3.0
10 Jan 2023- deprecated
Deprecate some APIs toward v5
- deprecated
Deprecate default export
middleware/persist: Hydrate in sync (new impl with storage option)
Throughout past years of development, we've learned the (mis)usage of the library. One of our goal is to provide smallest possible APIs. To go further, this version deprecates some features. They are still usable (with warnings), but will be removed in the future.
What's Changed
- deprecated
Deprecate some APIs toward v5
- deprecated
Deprecate default export
middleware/persist: Hydrate in sync (new impl with storage option)
4.2.0
1 Jan 2023middleware/devtools: Better redux devtools. One connection for all zustand stores
middleware/persist: New storage option
build: Disable esModule and re-export for nodejs
This version adds some new features in middleware.
What's Changed
middleware/devtools: Better redux devtools. One connection for all zustand stores
middleware/persist: New storage option
build: Disable esModule and re-export for nodejs
4.1.5
5 Dec 2022middleware/devtools: Do not use optional catch binding syntax
shallow: Add support of Maps and Sets to shallow comparator
Programmatic
module.exportsaddition for named and default exports in CJS
This version has several small improvements.
What's Changed
middleware/devtools: Do not use optional catch binding syntax
shallow: Add support of Maps and Sets to shallow comparator
Programmatic
module.exportsaddition for named and default exports in CJS
4.1.4
31 Oct 2022build: Use *.d.mts for esm ('import' condition only)
build: No import.meta for "module" condition
This should improve some importing problems. Uncertain if it fixes everything.
What's Changed
build: Use *.d.mts for esm ('import' condition only)
build: No import.meta for "module" condition
4.1.3
23 Oct 2022types: Assume
getStateandsetStatewill always exist on the storetypes: Fix
StateCreatorsubtyping
This improves store types for TS users. We also upgrade rollup. Please report issues if anyone finds any.
What's Changed
types: Assume
getStateandsetStatewill always exist on the storetypes: Fix
StateCreatorsubtyping
4.1.2
9 Oct 2022context: Store property missing from
useStoreApiShould use Object.is to compare two value
Rewrite
TakeTwo,SkipTwoandMutateto make them work for older ts versions too
This includes some fixes for edge cases. Most notably, supporting old TypeScript versions.
What's Changed
context: Store property missing from
useStoreApiShould use Object.is to compare two value
Rewrite
TakeTwo,SkipTwoandMutateto make them work for older ts versions too
4.1.1
22 Aug 2022middleware: Revert types of redux middleware
fix(types)(middleware/devtools): copy devtools option types instead of importing
In v4.1.0, there are some TypeScript type issues in
reduxanddevtoolsmiddleware, which should be fixed.What's Changed
middleware: Revert types of redux middleware
fix(types)(middleware/devtools): copy devtools option types instead of importing
4.1.0
18 Aug 2022fix(types)(middleware/devtools): fix action type in devtools's setState
vanilla: non-object state
fix(types)(middleware): use official Config type for options
This supports non-object state. It's probably one of the biggest changes in API design throughout the zustand development history. But, probably 99.9% of users won't use it 😝 .
What's Changed
fix(types)(middleware/devtools): fix action type in devtools's setState
vanilla: non-object state
fix(types)(middleware): use official Config type for options