github statelyai/xstate @xstate/svelte@3.0.3

latest releases: xstate@5.12.0, @xstate/vue@3.1.2
14 days ago

Patch Changes

  • #4844 5aa6eb05c Thanks @davidkpiano! - The useSelector(…) hook from @xstate/react is now compatible with stores from @xstate/store.

    import { createStore } from '@xstate/store';
    import { useSelector } from '@xstate/react';
    
    const store = createStore(
      {
        count: 0
      },
      {
        inc: {
          count: (context) => context.count + 1
        }
      }
    );
    
    function Counter() {
      // Note that this `useSelector` is from `@xstate/react`,
      // not `@xstate/store/react`
      const count = useSelector(store, (state) => state.context.count);
    
      return (
        <div>
          <button onClick={() => store.send({ type: 'inc' })}>{count}</button>
        </div>
      );
    }

Don't miss a new xstate release

NewReleases is sending notifications on new releases.