Created
April 21, 2021 23:45
-
-
Save ChrisShank/a7c11b06ad96dc31d1340439e304d76f 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 machine = Machine( | |
{ | |
id: 'app', | |
initial: 'loading', | |
states: { | |
loading: { | |
type: 'parallel', | |
states: { | |
animation: { | |
initial: 'animating', | |
states: { | |
animating: { | |
after: { | |
3000: 'completed', | |
}, | |
}, | |
completed: { type: 'final' }, | |
}, | |
}, | |
api: { | |
initial: 'fetching', | |
states: { | |
fetching: { | |
invoke: { | |
src: 'fetchFromAPI', | |
onDone: { target: 'completed', actions: 'assignData' }, | |
}, | |
}, | |
completed: { type: 'final' }, | |
} | |
}, | |
}, | |
onDone: 'completed', | |
}, | |
completed: {}, | |
} | |
}, | |
{ | |
services: { | |
fetchFromAPI: () => Promise.resolve([]) | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment