statemachine
Last updated
import { machine } from './myMachine'
export const state = {
myMachine: machine.create({ current: 'FOO' }, { list: [] })
}export const toggle = ({ state, effects }) => {
state.myMachine.send('TOGGLE', somePayload)
}export const toggle = ({ state, effects }) => {
if (state.myMachine.matches('FOO')) {
state.myMachine.send('TOGGLE', 'Cool')
} else {
state.myMachine.send('TOGGLE', 'Not so cool')
}
}