Last active
December 25, 2019 21:22
-
-
Save RafalFilipek/abe24f8f111907c28a55c6654db8a658 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or 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 m = Machine({ | |
id: 'error', | |
context: { | |
list: null, | |
currentItem: null, | |
}, | |
initial: 'init', | |
states: { | |
init: { | |
on: { | |
'SELECT': { | |
actions: assign({ | |
// THIS WILL FAIL | |
currentItem: (c) => c.list[2] | |
}) | |
}, | |
// 'SELECT2': { | |
// // THIS WILL FAIL HARD | |
// cond: (c) => c.list.length > 2 | |
// actions: assign({ | |
// currentItem: true | |
// }) | |
// } | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment