Last active
September 30, 2020 23:45
-
-
Save tomByrer/ffbd70d4cc5d66019e08ffcd799dc8a3 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 radioGroup = Machine( | |
{ | |
id: "radioGroup", | |
initial: "emptied", | |
context: { | |
selected: "", | |
}, | |
states: { | |
emptied: { | |
on: { | |
SELECT: { | |
target: "filled", | |
actions: ["selecting"], | |
}, | |
}, | |
}, | |
filled: { | |
on: { | |
SELECT: { | |
actions: ["selecting"], | |
}, | |
}, | |
}, | |
}, | |
}, | |
{ | |
actions: { | |
selecting: assign((context, event) => ({ | |
selected: event.selected, | |
})), | |
}, | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment