Skip to content

Releases: udecode/zustand-x

zustand-x@6.2.1

16 Oct 15:38
78abd51

Choose a tag to compare

Patch Changes

  • #120 by @zbeyens – Fix assigning function-valued options so callbacks still work.

zustand-x@6.2.0

15 Oct 13:51
5285dd4

Choose a tag to compare

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

25 Aug 17:13
3dc3fed

Choose a tag to compare

Patch Changes

zustand-x@6.1.1

17 Jun 09:27
101940b

Choose a tag to compare

Patch Changes

  • #113 by @yf-yang – Update readme and improve test cases related to immer style set

zustand-x@6.1.0

15 Feb 10:48
a6ed7d8

Choose a tag to compare

Minor Changes

zustand-x@6.0.3

05 Feb 12:19
dc76e8a

Choose a tag to compare

Patch Changes

zustand-x@6.0.2

05 Feb 09:06
6991af1

Choose a tag to compare

Patch Changes

zustand-x@6.0.1

05 Feb 08:58
f9d500b

Choose a tag to compare

Patch Changes

zustand-x@6.0.0

04 Feb 22:30
d36821a

Choose a tag to compare

Major Changes

  • #100 by @zbeyens – The store hooks are now part of the public API. Previously accessible only through the store object, 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, set to 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');

zustand-x@5.0.1

08 Jan 12:25
6bb9405

Choose a tag to compare

Patch Changes