Releases: udecode/zustand-x
zustand-x@6.2.1
zustand-x@6.2.0
Minor Changes
-
#117 by @felixfeng33 – Added
createVanillaStore: create a vanilla Zustand store in Node.js, workers, or any non-React environment. Example:import { createVanillaStore } from 'zustand-x/vanilla'; const store = createVanillaStore({ count: 0 }, { name: 'counter' }); store.get('count'); store.set('count', 1);
zustand-x@6.1.2
Patch Changes
- #115 by @RavenColEvol – fix support for set callback value
zustand-x@6.1.1
zustand-x@6.1.0
zustand-x@6.0.3
zustand-x@6.0.2
zustand-x@6.0.1
zustand-x@6.0.0
Major Changes
-
#100 by @zbeyens – The store hooks are now part of the public API. Previously accessible only through the
storeobject, they are now available as standalone hooks to ensure compatibility with the new React Compiler. Added standalone hooks:useStoreValue,useStoreState,useTracked,useTrackedStore.We're moving away from object namespaces like
use,get,setto a more functional approach where the first argument is the store state field. This includes the extended selectors and actions, where the parameters follow the first argument. This change simplifies the API and makes it more consistent with React hooks. Instead of accessing state through object properties (store.use.name()), we now use functions with the state field as the first argument (store.useValue('name')).Migration cases:
// Before: store.use.name(), store.use.extendedSelector(1, 2, (a, b) => a === b) useStoreValue(store, 'name'); useStoreValue(store, 'extendedSelector', 1, 2, (a, b) => a === b); // Equivalent to store.useValue('name'); store.useValue('extendedSelector', 1, 2, (a, b) => a === b); // Before: store.useTracked.name() useTracked(store, 'name'); // Equivalent to store.useTracked('name'); // Before: store.get.name(), store.get.extendedSelector(1, 2), store.get.state() store.get('name'); store.get('extendedSelector', 1, 2); store.get('state'); // Before: store.set.name('value'), store.set.extendedAction(1, 2), store.set.state(draft => { ... }) store.set('name', 'value'); store.set('extendedAction', 1, 2); store.set('state', (draft) => {}); // Before: store.extendSelectors((set, get, api) => ({ ... })). Now only api argument that you can destructure. store.extendSelectors(({ get }) => ({ ... })); // Before: store.extendActions((set, get, api) => ({ ... })). Now only api argument that you can destructure. store.extendActions(({ set }) => ({ ... }));
- Remove
mapValuesKey. This would be the equivalent:
const stores = { auth: authStore, combobox: comboboxStore, }; useValue(stores.auth, 'name'); useValue(stores.combobox, 'name');
- Remove
zustand-x@5.0.1
Patch Changes
- #95 by @imarabinda –
- fix: missing export
mapValuesKey
- fix: missing export