Skip to content

Instantly share code, notes, and snippets.

@SandroMaglione
Created January 3, 2024 18:39
Show Gist options
  • Save SandroMaglione/f4b8082e57392439c9d3cf4a35c5800c to your computer and use it in GitHub Desktop.
Save SandroMaglione/f4b8082e57392439c9d3cf4a35c5800c to your computer and use it in GitHub Desktop.
Setup code for an empty state machine in XState v5
import { setup } from "xstate";
const machine = setup({
types: {
context: {} as {},
events: {} as { readonly type: "event"; readonly params: {} },
},
actions: {},
}).createMachine({
id: "machine",
context: {},
initial: "Init",
states: {
Init: {},
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment