MCPcopy
hub / github.com/statelyai/xstate / ChildTest

Function ChildTest

packages/xstate-react/test/useActorRef.test.tsx:377–389  ·  view source on GitHub ↗
({ actor })

Source from the content-addressed store, hash-verified

375 const ChildTest: React.FC<{
376 actor: ActorRefFrom<typeof childMachine>;
377 }> = ({ actor }) => {
378 const state = useSelector(actor, (s) => s);
379
380 expect(state.value).toEqual('active');
381
382 React.useLayoutEffect(() => {
383 if (actor.getSnapshot().status === 'active') {
384 actor.send({ type: 'FINISH' });
385 }
386 }, []);
387
388 return null;
389 };
390
391 const Test = () => {
392 const actorRef = useActorRef(machine);

Callers

nothing calls this directly

Calls 3

useSelectorFunction · 0.90
getSnapshotMethod · 0.80
sendMethod · 0.80

Tested by

no test coverage detected