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

Function Toggle

packages/xstate-react/test/useActor.test.tsx:402–434  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

400 });
401
402 const Toggle = () => {
403 const [ext, setExt] = useState(false);
404
405 const doAction = React.useCallback(() => {
406 expect(ext).toBeTruthy();
407 resolve();
408 }, [ext]);
409
410 const [, send] = useActor(
411 toggleMachine.provide({
412 actions: {
413 doAction
414 }
415 })
416 );
417
418 return (
419 <>
420 <button
421 data-testid="extbutton"
422 onClick={(_) => {
423 setExt(true);
424 }}
425 />
426 <button
427 data-testid="button"
428 onClick={(_) => {
429 send({ type: 'TOGGLE' });
430 }}
431 />
432 </>
433 );
434 };
435
436 render(<Toggle />);
437

Callers

nothing calls this directly

Calls 3

useActorFunction · 0.90
provideMethod · 0.80
sendFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…