Skip to content

Instantly share code, notes, and snippets.

@tomByrer
Last active January 3, 2023 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tomByrer/fd763ff2c161b172f719891e2544d428 to your computer and use it in GitHub Desktop.
Save tomByrer/fd763ff2c161b172f719891e2544d428 to your computer and use it in GitHub Desktop.
// Demostrate `raise` action
const stubbornMachine = Machine({
id: 'raisedmo',
initial: 'entry',
states: {
entry: {
on: {
STEP: {
target: 'middle',
},
RAISE: {
target: 'middle',
// immediately invoke the NEXT event in 'middle'
actions: raise('NEXT')
},
},
},
middle: {
on: {
NEXT: 'last'
},
},
last: {
on: {
RESET: 'entry'
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment