Skip to content

Instantly share code, notes, and snippets.

@ShMcK
Created September 23, 2018 21:56
Show Gist options
  • Save ShMcK/8e3f959f001eec85287321e24eeb5b7f to your computer and use it in GitHub Desktop.
Save ShMcK/8e3f959f001eec85287321e24eeb5b7f to your computer and use it in GitHub Desktop.
xstateful-react machine setup
import { Machine } from 'xstate'
import { createStatefulMachine } from '@avaragado/xstateful'
import { createReactMachine } from '@avaragado/xstateful-react'
import machineState from './state.json'
// a stateless machine
const machine = Machine(machineState)
// a stateful machine
const xsf = createStatefulMachine({ machine })
// a React Context API synced state machine
export default createReactMachine(xsf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment