Skip to content

Instantly share code, notes, and snippets.

@signaes
Created May 21, 2020 16:28
Show Gist options
  • Save signaes/76bfcca1c463ca165e1ba930723eb574 to your computer and use it in GitHub Desktop.
Save signaes/76bfcca1c463ca165e1ba930723eb574 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 BACK_TO_DASHBOARD = { target: 'dashboard' }
const config = {
id: 'financesDashboard',
initial: 'idle',
states: {
idle: {
initial: 'dashboard',
states: {
dashboard: {
on: {
NEW_ACCOUNT: { target: 'account.new' },
PRODUCTS: { target: 'products' },
},
},
account: {
initial: 'idle',
on: { BACK_TO_DASHBOARD },
states: {
idle: {},
new: {},
},
},
invoices: {
on: { BACK_TO_DASHBOARD },
},
products: {
initial: 'idle',
on: {
BACK_TO_DASHBOARD,
EDIT: { target: 'products.edit' },
CREATE: { target: 'products.create' },
},
states: {
idle: {},
edit: {},
create: {},
},
},
statetement: {
on: { BACK_TO_DASHBOARD },
},
subscriptions: {
on: { BACK_TO_DASHBOARD },
},
},
},
},
}
const options= {}
const financesDashboardMachine = Machine(config, options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment