-
Notifications
You must be signed in to change notification settings - Fork 47
Updating from 0.X.X to 1.0.0
Cassio Zen edited this page Jul 27, 2021
·
2 revisions
Version 1.0 introduces a few API changes:
- No more curried function: Extended state is now declared within the State Machine configuration object
- New signature for
effects
andguards
Before
const [state, send] = useStateMachine(/* Context */)(/* Configuration */);
After
const [state, send] = useStateMachine(/* Configuration (including context) */);
- Both functions receive a single object with multiple keys instead of multiple parameters.
- Effects now receive the context.
- The context updater function inside
effect
is now calledsetContext
instead ofupdate
.
Here's a diff between the fetch example on versions 0.x.x and 1.0.0: