Created
September 19, 2020 19:32
-
-
Save zaydek/ead1677f8abc49569aada489c6d24f6a to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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