Skip to content

Instantly share code, notes, and snippets.

@tychota
Created April 7, 2021 12:50
Show Gist options
  • Save tychota/d4babdc653b15653134f2feae1a1e19d to your computer and use it in GitHub Desktop.
Save tychota/d4babdc653b15653134f2feae1a1e19d 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: 'submitted',
context: {
retries: 0
},
states: {
submitted: {
on: {
RECEIVE: 'received'
}
},
received: {
on: {
RESOLVE: 'accepted',
REJECT: 'rejected'
}
},
accepted: {
on: {
ANSWER: 'answered'
}
},
answered: {
type: 'final'
},
rejected: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment