github pmndrs/zustand v3.6.0

latest releases: v5.0.1, v5.0.0, v5.0.0-rc.2...
3 years ago

Summary

This version mainly comes with type improvement for middleware. It's tricky implementation-wise. Please report issues and let's look for solutions or workarounds.
It has renamed and deprecated types: UseStore 👉 UseBoundStore
A new subscribeWithSelector middleware is added, deprecating the equivalent feature in core.

Migrating to subscribeWithSelector middleware

Previously, you could do this:

const useStore = create(...)
useStore.subscribe(callback, selector, equalityFn)

which is deprecated and replaced with:

const useStore = create(subscribeWithSelector(...))
useStore.subscribe(selector, callback, { equalityFn }) // selector is not optional

What's Changed

  • feat(types): better middleware support by @dai-shi in #601
  • fix(types): Rename from UseStore to UseBoundStore by @dai-shi in #595
  • feat(middleware): subscribeWithSelector middleware by @dai-shi in #603

New Contributors

Full Changelog: v3.5.14...v3.6.0

Don't miss a new zustand release

NewReleases is sending notifications on new releases.