Skip to content

Instantly share code, notes, and snippets.

@FrankMerema
Last active May 29, 2020 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FrankMerema/839ca61100f6350714adfd3322bbfc82 to your computer and use it in GitHub Desktop.
Save FrankMerema/839ca61100f6350714adfd3322bbfc82 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const navigationMachine = Machine(
{
id: 'navigationMachine',
initial: 'initial',
context: {
addressValid: true,
fulfilmentValid: false,
slotsValid: false,
overviewValid: false,
thankyouValid: false,
},
states: {
initial: {
on: {
'': [
{ target: 'steps.wanneer', cond: () => false },
{ target: 'steps.hoe', cond: () => true },
{ target: 'steps.waar' }
]
}
},
steps: {
on: {
OVERVIEW: { target: 'overzicht' }
},
initial: 'waar',
states: {
waar: {
on: {
NEXT: { target: 'hoe' },
PREVIOUS: undefined,
}
},
hoe: {
on: {
NEXT: { target: 'wanneer' },
PREVIOUS: { target: 'waar' },
}
},
wanneer: {
on: {
NEXT: { target: '' },
PREVIOUS: { target: 'hoe' },
}
}
}
},
overzicht: {
on: {
NEXT: { target: 'bedankt' }
}
},
bedankt: {
type: 'final',
},
},
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment