Skip to content

Instantly share code, notes, and snippets.

@h-jennings
Created November 5, 2019 03:48
Show Gist options
  • Save h-jennings/656ab9c0c92a67ef294346ae7319b127 to your computer and use it in GitHub Desktop.
Save h-jennings/656ab9c0c92a67ef294346ae7319b127 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const allData = new Array(25).fill(0).map((_val, i) => i + 1);
const perPage = 10;
const dataMachine = new Machine({
id: 'dataMachine',
initial: 'loading',
context: {
data: [],
},
states: {
loading: {
on: {
DONE_MORE: 'more',
DONE_COMPLETE: 'complete',
FAIL: 'failure',
}
},
more: {
on: {
LOAD: 'loading',
}
},
complete: {
type: 'final',
},
failure: {
type: 'final',
},
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment