Long-awaited zustand v4!
We started working on #550 at Aug 31 2021. It's been more than 7 months!
Release status
Although this release is v4.0.0-rc.0, we treat this as a normal release. While we might make some changes before the final one, the stability of this release should be same as other releases like v3.7.*.
No breaking changes in JavaScript API
Most notably, this release is backward compatible with the latest v3 API. Some features deprecated in v3 are removed in v4. It's highly recommended to update to latest v3, before upgrading to v4, and check any deprecation messages.
Big rewrite in TypeScript
Zustand code in JS is surprisingly small, and its value is actually in TypeScript. Although it is very tricky to support mutation nature of zustand middleware, @devanshj did a great job to support types as much as possible. There are some breaking changes in types from v3. Please refer ./docs/typescript.md
and ./docs/v4-migration.md
.
Your feedback is necessary
As always, feedback is welcome, and even necessary this time because otherwise nothing happens. Please try v4 and open issues and discussions (discussions are preferable if you are not sure which).
What's Changed
- breaking(vanilla): drop deprecated store.subscribe with selector by @dai-shi in #604
- breaking(middleware): drop deprecated persist options and make removeItem required by @dai-shi in #598
- breaking(core): drop v2 hook compatibility by @dai-shi in #597
- breaking(types): drop deprecated UseStore type by @dai-shi in #596
- feat: use-sync-external-store by @dai-shi in #550
- breaking(middleware/devtools): use official devtools extension types by @dai-shi in #819
- breaking(middleware/devtools): remove deprecations and warnings by @devanshj in #892
- fix(build): separate vanilla build by @dai-shi in #904
- breaking(types): Add higher kinded mutator types by @devanshj in #725
- fix(index): export createStore from vanilla by @dai-shi in #914
- fix(middleware): separate immer middleware by @dai-shi in #915
- fix(middleware/devtools): add
enabled
option and show devtools warning only if enabled by @Aslemammad in #880
Full Changelog: v3.7.2...v4.0.0-rc.0