github statelyai/xstate @xstate/react@1.3.0

latest releases: @xstate/solid@0.2.3, @xstate/svelte@3.0.5, @xstate/vue@3.1.4...
3 years ago

Minor Changes

  • 577ae023 #1915 Thanks @davidkpiano! - New hook: useInterpret(machine), which is a low-level hook that interprets the machine and returns the service:

    import { useInterpret } from '@xstate/react';
    import { someMachine } from '../path/to/someMachine';
    
    const App = () => {
      const service = useInterpret(someMachine);
    
      // ...
    };
  • 577ae023 #1915 Thanks @davidkpiano! - New hook: useSelector(actor, selector), which subscribes to actor and returns the selected state derived from selector(snapshot):

    import { useSelector } from '@xstate/react';
    
    const App = ({ someActor }) => {
      const count = useSelector(someActor, state => state.context.count);
    
      // ...
    };

Don't miss a new xstate release

NewReleases is sending notifications on new releases.