Skip to content

Instantly share code, notes, and snippets.

@ducksoupdev
Created May 10, 2021 10:11
Show Gist options
  • Save ducksoupdev/97f08f22b80d7cd8959f668b0b302551 to your computer and use it in GitHub Desktop.
Save ducksoupdev/97f08f22b80d7cd8959f668b0b302551 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: 'idle',
states: {
idle: {
on: {
CLICK: 'loading'
}
},
loading: {
on: {
RESOLVE: 'person',
REJECT: 'error'
}
},
person: {
on: {
CLICK: 'loading'
}
},
error: {
on: {
CLICK: 'loading'
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment