Skip to content

Instantly share code, notes, and snippets.

@guilherme-teodoro
Created May 6, 2021 14:02
Show Gist options
  • Save guilherme-teodoro/37c88e5a477f92b84843939f70325377 to your computer and use it in GitHub Desktop.
Save guilherme-teodoro/37c88e5a477f92b84843939f70325377 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const wizardMachine = Machine({
initial: 'identification',
context: { isEligible: false },
states: {
identification: {
on: {
NEXT: 'address'
}
},
address: {
on: {
NEXT: [
{ target: 'payment', cond: (context) => context.isEligible },
{ target: 'unavailable' }
]
}
},
payment: {
on: {
NEXT: 'obrigado'
}
},
unavailable: {
type: 'final'
},
obrigado: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment