Skip to content

Instantly share code, notes, and snippets.

@jimthoburn
Created August 23, 2021 15:35
Show Gist options
  • Save jimthoburn/5376d2e769777520f7aa6a6799296c57 to your computer and use it in GitHub Desktop.
Save jimthoburn/5376d2e769777520f7aa6a6799296c57 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: 'submit',
initial: 'idle',
states: {
idle: {
on: {
SUBMIT: 'submitting'
}
},
submitting: {
on: {
COMPLETE: 'success',
ERROR: 'error'
}
},
success: {
type: 'final'
},
error: {
on: {
SUBMIT: {
target: 'submitting'
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment