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

Function App

packages/xstate-solid/test/useActor.test.tsx:394–413  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

392 });
393
394 const App = () => {
395 const [stateCount, setStateCount] = createSignal(0);
396 const [state, send] = useActor(machine);
397 createEffect(
398 on(
399 () => state.context.count,
400 () => {
401 setStateCount((c) => c + 1);
402 }
403 )
404 );
405 onMount(() => {
406 send({ type: 'EVENT' });
407 send({ type: 'EVENT' });
408 send({ type: 'EVENT' });
409 send({ type: 'EVENT' });
410 });
411
412 return <div data-testid="count">{stateCount()}</div>;
413 };
414
415 render(() => <App />);
416

Callers

nothing calls this directly

Calls 5

useActorFunction · 0.90
onFunction · 0.85
provideMethod · 0.80
sendFunction · 0.50
toJSONMethod · 0.45

Tested by

no test coverage detected