Skip to content

Instantly share code, notes, and snippets.

@danielsdesk
Created December 13, 2019 05:13
Show Gist options
  • Save danielsdesk/c3cafb0d510c9691393aba82a76ca175 to your computer and use it in GitHub Desktop.
Save danielsdesk/c3cafb0d510c9691393aba82a76ca175 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const stepMachine = Machine(
{
id: "steps",
initial: "step1",
states: {
step1: {
on: {
NEXT: "step2"
}
},
step2: {
initial: 'a',
states: {
a: {
on: { NEXT_FIELD: 'b'}
},
b: {
on: { NEXT_FIELD: 'c'}
},
c: {},
hist: { type: 'history' }
},
on: {
NEXT: "step3",
PREV: "step1"
}
},
step3: {
on: {
PREV: "step2.hist"
}
}
},
on: {
GOTO_STEP1: "step1",
GOTO_STEP2: "step2",
GOTO_STEP3: "step3"
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment