Skip to content

Instantly share code, notes, and snippets.

@deanrad
Created January 11, 2022 23:22
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 deanrad/37e81152e6e23bc34f5262bd1a9102c1 to your computer and use it in GitHub Desktop.
Save deanrad/37e81152e6e23bc34f5262bd1a9102c1 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 increment = (context) => context.count + 1;
const isNotMax = (context) => context.count < 3;
const fetchMachine = Machine( {
initial: "active",
context: {
count: 0
},
states: {
active: {
on: {
INC: {
actions: [assign({ count: increment }), "bellBusTrigger"],
cond: isNotMax
},
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment