
One Cool Trick to Simplify Reducer Functions - ericelliott
https://medium.com/javascript-scene/one-cool-trick-to-simplify-reducer-functions-bbbffe488bb6
======
acemarke
Note that our official Redux Toolkit package [0] already uses Immer by
default, and we have recommended using Immer with Redux in our Style Guide
docs page [1]. (We also specifically recommend _against_ using Immutable.js in
that page as well.)

Fun fact: because reducers are _just_ plain functions, there's not actually
anything Redux-specific about them. That means you can use any reducer with
React's `useReducer` hook as well. I've used RTK's `createSlice` function to
generate strongly-TS-typed reducers for use in React components a number of
times.

[0] [https://redux-toolkit.js.org](https://redux-toolkit.js.org)

[1] [https://redux.js.org/style-guide/style-guide#use-immer-
for-w...](https://redux.js.org/style-guide/style-guide#use-immer-for-writing-
immutable-updates)

