Last active
September 29, 2020 13:06
-
-
Save James-Byrne/bccb2a4cd6186134a57b6458ecc2fd59 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
// Test to show onEntry triggers on an internal transition to self | |
const onEntryMachine = Machine({ | |
id: 'onEntryTest', | |
initial: 'initial', | |
context: { | |
retries: 0 | |
}, | |
states: { | |
initial: { | |
on: { | |
MOVE: 'elsewhere' | |
} | |
}, | |
elsewhere: { | |
onEntry: ['logEntry'], | |
on: { | |
BACK: 'initial', | |
INTERNAL_TRANSITION: 'elsewhere', | |
} | |
}, | |
}, | |
}, { | |
actions: { | |
logEntry(context) { | |
console.log('onEntry > context', context); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment