Skip to content

Instantly share code, notes, and snippets.

@azs06
Created March 30, 2023 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azs06/741dbf216ab451a34282cf10d7f114e6 to your computer and use it in GitHub Desktop.
Save azs06/741dbf216ab451a34282cf10d7f114e6 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const roomsMachine = Machine({
id: 'rooms',
initial: 'step1',
states: {
step1: {
on: { STEP: 'step2' },
},
step2: {
on: { STEP: 'step3' },
},
step3: {
type: 'final',
},
},
})
const reservationMachine = Machine({
id: 'reservation',
initial: 'idle',
states: {
idle: {
on: { ACTIVATE: 'active' },
},
active: {
invoke: {
id: 'rooms',
src: 'roomsMachine',
onDone: 'done',
},
on: {
STEP: {
actions: send('STEP', { to: 'child' }),
},
MODIFY: {
actions: send('MODIFY', {to: 'child'})
}
},
},
done: {},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment