()
| 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 |