Skip to content

Instantly share code, notes, and snippets.

@renerbaffa
Created April 1, 2020 08:08
Show Gist options
  • Save renerbaffa/63c22e23c73496e2db03f9d6848d229b to your computer and use it in GitHub Desktop.
Save renerbaffa/63c22e23c73496e2db03f9d6848d229b to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const priceCalculatorMachine = Machine({
id: 'priceCalculatorMachine',
initial: 'active',
context: {
flag: false,
},
states: {
active: {
on: {
TOGGLE: {
actions: assign({
flag: context => !context.flag,
}),
},
},
},
},
})
const stepperMachine = Machine({
id: 'stepperMachine',
initial: 'priceCalculator',
states: {
priceCalculator: {
invoke: {
id: 'priceCalculatorMachine',
src: priceCalculatorMachine,
onDone: {
actions: assign((context) => {
console.log('DONE!')
return context
}),
},
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment