Skip to content

Instantly share code, notes, and snippets.

@Glutnix
Created February 3, 2020 00:09
Show Gist options
  • Select an option

  • Save Glutnix/e1ffe79f51c84b9c347ebc6ce789673b to your computer and use it in GitHub Desktop.

Select an option

Save Glutnix/e1ffe79f51c84b9c347ebc6ce789673b to your computer and use it in GitHub Desktop.

Revisions

  1. Glutnix created this gist Feb 3, 2020.
    30 changes: 30 additions & 0 deletions machine.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@

    // Available variables:
    // - Machine
    // - interpret
    // - assign
    // - send
    // - sendParent
    // - spawn
    // - raise
    // - actions
    // - XState (all XState exports)

    const toggleMachine = Machine({
    id: "toggle",
    initial: "inactive",
    states: {
    inactive: {
    on: {
    TOGGLE: "active"
    }
    },
    active: {
    on: {
    TOGGLE: "inactive"
    }
    }
    }
    });