Skip to content

Instantly share code, notes, and snippets.

@SimeonC
Created November 24, 2020 09:07
Show Gist options
  • Save SimeonC/b54b10892793b2208d879f3c7de8c2ac to your computer and use it in GitHub Desktop.
Save SimeonC/b54b10892793b2208d879f3c7de8c2ac 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 shopLoadingMachine = Machine({
id: 'shop-loading',
initial: 'entry',
context: {
shopSettings: null
},
states: {
entry: {
on: {
LOAD: {
target: 'step1_invalid',
actions: assign({
shopSettings: (context, { shopSettings }) => shopSettings
})
}
}
},
step1_invalid: {
on: {
ENTER_NAME: 'step1_valid',
GO_BACK: 'step1_invalid',
GO_NEXT: 'step1_invalid'
}
},
step1_valid: {
on: {
GO_BACK: 'step1_valid',
GO_NEXT: 'step2'
}
},
step2: {}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment