9cc6ba93ab
Hello this PR is in order to update xstate to the lastest version and use the `createMachine` method instead of `Machine`. I also added the inspect mode in order to show how we could use into a next.js app. ## Documentation / Examples - [x] Make sure the linting passes
14 lines
254 B
JavaScript
14 lines
254 B
JavaScript
import { createMachine } from 'xstate'
|
|
|
|
export const toggleMachine = createMachine({
|
|
id: 'toggle',
|
|
initial: 'inactive',
|
|
states: {
|
|
inactive: {
|
|
on: { TOGGLE: 'active' },
|
|
},
|
|
active: {
|
|
on: { TOGGLE: 'inactive' },
|
|
},
|
|
},
|
|
})
|