Created
April 1, 2020 08:08
-
-
Save renerbaffa/63c22e23c73496e2db03f9d6848d229b to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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