Created
September 23, 2018 21:56
-
-
Save ShMcK/8e3f959f001eec85287321e24eeb5b7f to your computer and use it in GitHub Desktop.
xstateful-react machine setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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