Skip to content

Instantly share code, notes, and snippets.

@codeincontext
Created November 9, 2020 11:27
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 codeincontext/b64990c5541db9066c4e1ae78cd0d208 to your computer and use it in GitHub Desktop.
Save codeincontext/b64990c5541db9066c4e1ae78cd0d208 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const machine = Machine(
{
id: "address",
initial: "init",
context: {},
states: {
init: {
on: {
"": [
{ target: "edit", cond: "alreadyHasValues" },
{ target: "search" },
],
},
},
search: {
on: {
FOUND: "edit",
FAILED: "edit",
EDIT: "edit",
},
},
edit: {},
},
},
{
guards: {
alreadyHasValues: (context) => !!context.alreadyHasValues,
},
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment