github statelyai/xstate @xstate/store@2.3.0

20 days ago

Minor Changes

  • #5056 8c35da9a72 Thanks @steveadams! - You can now use the xstate/store package with SolidJS.

    Import useSelector from @xstate/store/solid. Select the data you want via useSelector(…) and send events using store.send(eventObject):

    import { donutStore } from './donutStore.ts';
    import { useSelector } from '@xstate/store/solid';
    
    function DonutCounter() {
      const donutCount = useSelector(donutStore, (state) => state.context.donuts);
    
      return (
        <div>
          <button onClick={() => donutStore.send({ type: 'addDonut' })}>
            Add donut ({donutCount()})
          </button>
        </div>
      );
    }

Don't miss a new xstate release

NewReleases is sending notifications on new releases.