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

Function Toggle

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

Source from the content-addressed store, hash-verified

322 });
323
324 const Toggle = () => {
325 const [ext, setExt] = createSignal(false);
326
327 const doAction = () => {
328 expect(ext()).toBeTruthy();
329 resolve();
330 };
331
332 const [, send] = useActor(
333 toggleMachine.provide({
334 actions: {
335 doAction
336 }
337 })
338 );
339
340 return (
341 <div>
342 <button
343 data-testid="extbutton"
344 onclick={(_) => {
345 setExt(true);
346 }}
347 />
348 <button
349 data-testid="button"
350 onclick={(_) => {
351 send({ type: 'TOGGLE' });
352 }}
353 />
354 </div>
355 );
356 };
357
358 render(() => <Toggle />);
359

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…