Skip to content

Instantly share code, notes, and snippets.

@codeincontext
Last active June 19, 2020 11:57
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 codeincontext/2c5d48944f414f1697c55a71c8e1e692 to your computer and use it in GitHub Desktop.
Save codeincontext/2c5d48944f414f1697c55a71c8e1e692 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 fetchMachine = Machine({
id: 'wizard',
initial: 'nameEntry',
context: {
},
states: {
nameEntry: {
on: {
NEXT: 'dobEntry'
}
},
dobEntry: {
on: {
BACK: 'nameEntry',
NEXT: 'phoneEntry'
}
},
phoneEntry: {
on: {
BACK: 'dobEntry',
NEXT: 'addressEntry.hist'
}
},
addressEntry: {
initial: 'lookup',
states: {
lookup: {
on: {
FOUND: 'manual',
FAILED: 'manual',
}
},
manual: {
on: {
ADD_PREVIOUS: 'previous',
}
},
previous: {
on: {
REMOVE: 'manual'
}
},
hist: {
type: 'history',
},
},
on: {
BACK: 'phoneEntry',
NEXT: 'confirmation'
}
},
confirmation: {
on: {
EDIT_NAME: 'nameEntry',
EDIT_DOB: 'dobEntry',
EDIT_PHONE: 'phoneEntry',
EDIT_ADDRESS: 'addressEntry.hist',
EDIT_PREVIOUS_ADDRESS: 'addressEntry.previous',
BACK: 'nameEntry',
SAVE: 'completed'
}
},
completed: {
type: 'final'
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment