Skip to content

Instantly share code, notes, and snippets.

@pieh
Created July 7, 2020 11:38
Show Gist options
  • Save pieh/610bc765e60b10833e63ade8229860ef to your computer and use it in GitHub Desktop.
Save pieh/610bc765e60b10833e63ade8229860ef 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: 'fetch',
initial: 'special',
states: {
special: {
on: {
// jokes on you I have different handling for this event
GO_TO_RANDOM1: 'random2',
GO_TO_RANDOM2: 'random1'
}
},
random1: {},
random2: {}
},
on: {
GO_TO_SPECIAL: 'special',
GO_TO_RANDOM1: 'random1',
GO_TO_RANDOM2: 'random2'
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment