Skip to content

Instantly share code, notes, and snippets.

@hosmelq
Last active October 9, 2019 23:21
Show Gist options
  • Save hosmelq/e77d366a0209242f9a15b11bada20112 to your computer and use it in GitHub Desktop.
Save hosmelq/e77d366a0209242f9a15b11bada20112 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({
initial: `applicant`,
name: `applicants.create`,
context: {
tabIndex: 0
},
states: {
applicant: {
on: {
NEXT: {
target: `vehicle`,
actions: assign({tabIndex: 1})
}
}
},
vehicle: {
on: {
NEXT: {
target: `cellphone`,
actions: assign({tabIndex: 2})
},
PREV: {
target: `applicant`,
actions: assign({tabIndex: 0})
}
}
},
cellphone: {
on: {
NEXT: {
target: `contact`,
actions: assign({tabIndex: 3})
},
PREV: {
target: `vehicle`,
actions: assign({tabIndex: 1})
}
}
},
contact: {
on: {
NEXT: {
target: `comment`,
actions: assign({tabIndex: 4})
},
PREV: {
target: `cellphone`,
actions: assign({tabIndex: 2})
}
}
},
comment: {
on: {
PREV: {
target: `contact`,
actions: assign({tabIndex: 3})
}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment