Skip to content

Instantly share code, notes, and snippets.

@cherta
Created May 19, 2020 19:45
Show Gist options
  • Save cherta/3f1ace4179121466266d6bec3460214b to your computer and use it in GitHub Desktop.
Save cherta/3f1ace4179121466266d6bec3460214b to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const covidMachine = Machine({
id: 'covid',
initial: 'landing',
context: {
comorbidities: {},
demographics: {},
symptoms: {},
travel: {},
distancing: {},
},
states: {
landing: {
on: {
NEXT: 'comorbidities'
}
},
comorbidities: {
on: {
NEXT: {
target: 'success',
actions: assign({
comorbidities: (context, event) => {
return {
diabetes: event.diabetes
};
}
}),
}
}
},
success: {
type: 'final'
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment