Skip to content

Instantly share code, notes, and snippets.

@ekozhura
Last active November 22, 2019 16:01
Show Gist options
  • Save ekozhura/e5e5c5bf1c6906653c404123f8fa6c45 to your computer and use it in GitHub Desktop.
Save ekozhura/e5e5c5bf1c6906653c404123f8fa6c45 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 fetchMachine = Machine({
id: 'form',
initial: "initial",
states: {
initial: {
on: {
DATA_MISSED: "missing"
}
},
missing: {
initial: "hasName",
states: {
hasName: {
on: { HAS_NAME: "hasDetails" }
},
hasDetails: {
on: {
HAS_NAME: "#accepted.hasName"
}
}
},
},
accepted: {
id: 'accepted',
initial: "hasName",
states: {
hasName: {
on: { HAS_NAME: "hasDetails" }
},
hasDetails: {
}
},
on: { HAS_NO_NAME: "missing.hasDetails" }
},
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment