Install
You have to installxstate and jotai-xstate to use this feature.
atomWithMachine
atomWithMachine creates a new atom with XState machine.
It receives a function getMachine to create a new machine.
getMachine is invoked at the first use with get argument,
with which you can read other atom values.
Restartable machine stored in a global Provider (provider-less mode)
When your machine reaches its final state it cannot receive any more events. If your atomWithMachine is initialized in global store (aka provider-less mode), to restart it you need to send aRESTART event to your machine like so: