Skip to content

Instantly share code, notes, and snippets.

@tomByrer
Last active September 30, 2020 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomByrer/ffbd70d4cc5d66019e08ffcd799dc8a3 to your computer and use it in GitHub Desktop.
Save tomByrer/ffbd70d4cc5d66019e08ffcd799dc8a3 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
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