I’ve started studying how an immutable version of Connect could work. I tried an implementation based on
immer and I’m trying another one now using
The goals are:
- Take advantage of the Redux DevTools (as opposed to creating our own DevTools).
- Prepare it for Concurrent mode (immutable state managers are a better fit for Concurrent).
- Add action/state hooks (this will supersede the Frontity Hooks).
Extra goals can be:
- Finally figure out how to create nested derived state.
- Switch to a setter function:
setState(s => s.x = "x")vs
state.x = "x". This would add compatibility with old browsers and would easy the implementation.
This might or might not require a backward compatible change, depending on the final API (so Frontity v2), but it is a possibility.
I’ve recorded a video with a summary of the current status:
And this is the codesandbox I am using: Immutable Connect (with valtio) - CodeSandbox