You'll find a working example using immer's + React's useReducer and Reducer type as well as a version using useImmerReducer. They both technically work perfectly fine, it's just a typing issue. See the comments in the code for more explanation.
I know it's not a huge deal, but if I can help and improve this little 💎then that'd be awesome!
Hi there,
❤️ immer, and ❤️this little gem on top, making it even easier/more readable to use immer for my reducers.
However, when using
useImmerReducer
I cannot get the resultingstate
anddispatch
to be typed correctly, I getany
for both instead.Here's a CodeSandbox showing the issue: https://codesandbox.io/s/p75vmyvo1j
You'll find a working example using
immer
's + React'suseReducer
andReducer
type as well as a version usinguseImmerReducer
. They both technically work perfectly fine, it's just a typing issue. See the comments in the code for more explanation.I know it's not a huge deal, but if I can help and improve this little 💎then that'd be awesome!
✌️