Skip to content

Instantly share code, notes, and snippets.

@jondruse
Created April 12, 2021 16:11
Show Gist options
  • Save jondruse/816dd106a11bb8c29b59ffa13e7dc249 to your computer and use it in GitHub Desktop.
Save jondruse/816dd106a11bb8c29b59ffa13e7dc249 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: {
FETCH: 'loading'
}
},
loading: {
on: {
RESOLVE: 'success'
}
},
success: {
type: 'final'
},
failure: {
on: {
RETRY: {
target: 'loading'
}
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment