immer-reducer icon indicating copy to clipboard operation
immer-reducer copied to clipboard

Share example project on README?

Open bhgsbatista opened this issue 6 years ago • 0 comments

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


image

bhgsbatista avatar Apr 10 '20 17:04 bhgsbatista