useStateMachine
https://gyazo.com/e275fabb4ddfca5c4e30d93a67920a86
例
code:ts
initial: 'inactive',
states: {
inactive: {
on: { TOGGLE: 'active' },
},
active: {
on: { TOGGLE: 'inactive' },
effect() {
console.log('Just entered the Active state');
// Same cleanup pattern as useEffect:
// If you return a function, it will run when exiting the state.
return () => console.log('Just Left the Active state');
},
},
},
});
effect()は単なるcallback