Last active
April 30, 2020 17:09
-
-
Save Harrisonkamau/e6b97406df015aa9dd7ad4d0fbdeb103 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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 paymentMachine = Machine({ | |
id: 'payment', | |
initial: 'plan', | |
states: { | |
plan: { | |
initial: '$10', | |
states: { | |
'$10': { on: { SWITCH_PLAN: '$20' } }, | |
'$20': { on: { SWITCH_PLAN: '$10' } }, | |
hist: { type: 'history' }, | |
}, | |
on: { NEXT: 'method' }, | |
}, | |
method: { | |
initial: 'cash', | |
states: { | |
cash: { on: { SWITCH_CARD: 'card' } }, | |
card: { on: { SWITCH_CASH: 'cash' } }, | |
hist: { type: 'history' }, | |
}, | |
on: { PLAN: 'plan.hist' }, | |
on: { NEXT: 'review' }, | |
}, | |
review: { | |
on: { PREVIOUS: 'method.hist' }, | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment