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

Function Component

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

Source from the content-addressed store, hash-verified

269 });
270
271 const Component = () => {
272 const [ext, setExt] = useState(1);
273
274 const [, send] = useActor(
275 toggleMachine.provide({
276 actions: {
277 setLatest: assign({
278 latest: () => {
279 expect(ext).toBe(2);
280 resolve();
281 return ext;
282 }
283 })
284 }
285 })
286 );
287
288 return (
289 <>
290 <button
291 data-testid="extbutton"
292 onClick={(_) => {
293 setExt(2);
294 }}
295 />
296 <button
297 data-testid="button"
298 onClick={(_) => {
299 send({ type: 'SET_LATEST' });
300 }}
301 />
302 </>
303 );
304 };
305
306 render(<Component />);
307

Callers

nothing calls this directly

Calls 4

useActorFunction · 0.90
assignFunction · 0.85
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…