Using ImmerReducer with TypeScript is such a pleasant experience, everything is type-safe, and with some extra work you can have the compiler enforce immutability on the state outside of producers.
I built a little React based calendar app that uses two ImmerReducers for state management. This example provides a useful foundation to build a more complex app made up of several small reducers:
Using ImmerReducer with TypeScript is such a pleasant experience, everything is type-safe, and with some extra work you can have the compiler enforce immutability on the state outside of producers.
I built a little React based calendar app that uses two ImmerReducers for state management. This example provides a useful foundation to build a more complex app made up of several small reducers:
https://github.com/gamedevsam/calendar-appointments
The magic sauce are these files in the Redux directory:
And of course the connector components:
One other noteworthy thing is the immutable generic type, which allows TypeScript to enforce immutability at compile time: src/types/immutable.ts