Skip to content

Instantly share code, notes, and snippets.

@zaydek

zaydek/machine.js

Created Sep 19, 2020
Embed
What would you like to do?
Generated by XState Viz: https://xstate.js.org/viz
const userMachine = Machine({
id: "user",
initial: "loading",
states: {
loading: {
invoke: {
id: "loadingHandler",
src: (ctx, _) => (callback, _) => {
setTimeout(() => {
callback("success")
}, 1e3)
},
},
},
success: {
type: "final",
},
failure: {
on: {
RETRY: "loading"
},
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.