rsnext/examples/with-xstate/machines/toggleMachine.js
Mohamed SADAT 9cc6ba93ab
update with-xstate example and add documentation for inspect package usage (#23287)
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
2021-03-23 15:04:53 +00:00

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' },
},
},
})