Ir al contenido
verdict:

Zustand 5.0.0

featured

note: la síntesis y las notas de la versión están en inglés

warning: requiere intervención

9 breaking changes4 puntos clave

Zustand v5 adds no new features but drops many old APIs, so upgrading needs the migration guide.

síntesis · solo a partir de las notas de la versión · claude-haiku-5-5 · prompt v7

breaking changestodos citados, cada uno con su solución

breaking[1]: Default exports are removed.

Drop default exports

help: Follow the migration guide linked in the release notes.

breaking[2]: Deprecated features are removed.

Drop deprecated features

help: Follow the migration guide linked in the release notes.

breaking[3]: React 18 becomes the minimum required version.

Make React 18 the minimum required version

help: Upgrade React to version 18 or newer before upgrading Zustand.

breaking[4]: TypeScript 4.5 becomes the minimum required version.

Make TypeScript 4.5 the minimum required version

help: Upgrade TypeScript to version 4.5 or newer.

breaking[5]: UMD and SystemJS support is dropped.

Drop UMD/SystemJS support

help: Follow the migration guide linked in the release notes.

breaking[6]: ES5 support is dropped.

Drop ES5 support

help: Follow the migration guide linked in the release notes.

breaking[7]: Types are stricter when setState's replace flag is set.

Stricter types when setState's replace flag is set

help: Check your setState calls that use the replace flag for type errors.

breaking[8]: The persist middleware behaves differently.

Persist middleware behavioral change

help: Check your persist middleware usage against the migration guide linked in the release notes.

breaking[9]: Other small improvements include changes that are technically breaking.

Other small improvements (technically breaking changes)

help: Check the migration guide linked in the release notes for details.

puntos clave

release-notesgithub.com/pmndrs/zustand · 58 líneas
  1. # 🎉🎉🎉 Zustand v5 🐻🐻🐻
  2. ## TL;DR
  3. - No new features
  4. - Drop many old things
  5. - Migration from v4 should be smooth.
  6. ## Changes in v5
  7. - Drop default exports
  8. - Drop deprecated features
  9. - Make React 18 the minimum required version
  10. - Make use-sync-external-store a peer dependency (required for `createWithEqualityFn` and `useStoreWithEqualityFn` in `zustand/traditional`)
  11. - Make TypeScript 4.5 the minimum required version
  12. - Drop UMD/SystemJS support
  13. - Organize entry points in the package.json
  14. - Drop ES5 support
  15. - Stricter types when setState's replace flag is set
  16. - Persist middleware behavioral change
  17. - Other small improvements (technically breaking changes)
  18. ## Migration Guide
  19. Read the migration guide carefully:
  20. https://github.com/pmndrs/zustand/blob/main/docs/migrations/migrating-to-v5.md
  21. ### Frequently Reported Issue
  22. During the RC period, some users encountered the following infinite loop error:
  23. ```
  24. 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.
  25. ```
  26. 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 `useShallow` often fixes the problem.
  27. ## What's Changed
  28. * v5 by @dai-shi in https://github.com/pmndrs/zustand/pull/2138
  29. * Fix Immer type inference for `setState` by @chrisvander in https://github.com/pmndrs/zustand/pull/2696
  30. ## New Contributors
  31. * @abernier made their first contribution in https://github.com/pmndrs/zustand/pull/2674
  32. * @tthallos made their first contribution in https://github.com/pmndrs/zustand/pull/2501
  33. * @sagiereder made their first contribution in https://github.com/pmndrs/zustand/pull/2673
  34. * @melutovich made their first contribution in https://github.com/pmndrs/zustand/pull/2692
  35. * @rgksugan made their first contribution in https://github.com/pmndrs/zustand/pull/2695
  36. * @Anuovec made their first contribution in https://github.com/pmndrs/zustand/pull/2708
  37. * @EthanRBrown made their first contribution in https://github.com/pmndrs/zustand/pull/2717
  38. * @mym0404 made their first contribution in https://github.com/pmndrs/zustand/pull/2730
  39. * @87xie made their first contribution in https://github.com/pmndrs/zustand/pull/2745
  40. * @f312213213 made their first contribution in https://github.com/pmndrs/zustand/pull/2761
  41. * @DanThemes made their first contribution in https://github.com/pmndrs/zustand/pull/2764
  42. * @chaficnajjar made their first contribution in https://github.com/pmndrs/zustand/pull/2770
  43. * @goosewobbler made their first contribution in https://github.com/pmndrs/zustand/pull/2781
  44. * @Amyssyko made their first contribution in https://github.com/pmndrs/zustand/pull/2784
  45. * @MartinGamesCZ made their first contribution in https://github.com/pmndrs/zustand/pull/2785
  46. **Full Changelog**: https://github.com/pmndrs/zustand/compare/v4.5.5...v5.0.0

ver en githubimported 2026-09-28 vía npm