v3.6.0
Two New Features!
useDispatch
You can now get a reference to the dispatch function without registering for state changes. This is useful for components that want to fire changes while still being pure, or for components that useSubstate
multiple times and only want to deal with one reference to dispatch
.
Passing multiple substates to usePatchEffect
Previously when using usePatchEffect
you could either create a patch effect for all substate changes or changes to a single substate. Now, you can add a patch effect for changes to multiple substates without needing to call usePatchEffect multiple times. This should help slim down the size of components using this functionality.
One New Compatibility Update
The peer dependency on Immer has been moved from version 6 to version 7. Version 6 will still work perfectly fine as far as React Substate is concerned, but users now have the option to move to version 7 without being hit with an npm peer dependency warning.