Skip to content

Instantly share code, notes, and snippets.

@RainerAtSpirit
Last active November 20, 2019 13:09
Show Gist options
  • Save RainerAtSpirit/699e16beb4766726ac5f2a8ef76156ca to your computer and use it in GitHub Desktop.
Save RainerAtSpirit/699e16beb4766726ac5f2a8ef76156ca 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: 'categoryActor',
initial: 'loading',
context: {
categoryId: '123',
categoryMap: {}
},
states: {
loading: {
invoke: {
id: 'getCategories',
src: 'getCategories',
onDone: {
target: 'loaded',
actions: 'onDoneLoading'
},
onError: 'failure'
}
},
loaded: {
entry: 'entryLoaded',
on: {
REFRESH: 'loading'
}
},
failure: {
on: {
RETRY: 'loading'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment