Minor Changes
-
577ae023
#1915 Thanks @davidkpiano! - New hook:useInterpret(machine)
, which is a low-level hook that interprets themachine
and returns theservice
: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 toactor
and returns the selected state derived fromselector(snapshot)
:import { useSelector } from '@xstate/react'; const App = ({ someActor }) => { const count = useSelector(someActor, state => state.context.count); // ... };