Skip to content

Instantly share code, notes, and snippets.

@pavankataria
Last active January 2, 2021 03:47
Show Gist options
  • Save pavankataria/4ed6f8f87eff00d90c2d5e2f02da4874 to your computer and use it in GitHub Desktop.
Save pavankataria/4ed6f8f87eff00d90c2d5e2f02da4874 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// A very cool visualisation machine
// Allows you to see what the state machine does
// And how it transitions from one state to the next
const toggleMachine = new Machine({
id: 'toggleMachine',
initial: 'inactive',
states: {
inactive: {
// Tell it which events the state should listen for.
// And you do that by defining an on property.
on: {
TOGGLE: 'active'
}
},
active: {
on: {
TOGGLE: 'inactive'
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment