-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Consider adding an option to remove immer #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry, but no. The explicit point of this library is to make the default use cases simpler. If you don't want to use Immer, don't use I agree that the teaching aspect makes things more complicated, but that's a tradeoff I think most folks are happy with. |
How is it simpler if you have to remember "I mutated the state, better not return a new object here" every time you write a reducer? |
Because if you're using RSK, that's generally the pattern you should be following, and Immer will warn or throw errors if you mess up. As I said: half the point of RSK is to use Immer. If you don't want to use Immer, don't use RSK, or don't mutate in the reducers. |
@markerikson I have a question and also a suggestion to make immer js optional. If there is a significant performance impact on processing, then immer js can be made optional so that the developer have to make sure that state is updated not mutated. |
This has been discussed multiple times. You will not have any significant performance issues unless you read or write tens of thousands of times in a single reducer, and in that case you can just use We will not change this, it is not up for discussion. |
@yash-saini275 Per the perf question, see https://immerjs.github.io/immer/docs/performance . Beyond that, this has been extensively discussed in #242 , and as Lenz said, this is non-negotiable - we are not changing Immer or making it configurable. |
I like this library, but I want to use it without immer.
It's confusing to newcomers when they read everywhere online that they shouldn't mutate state in Redux, only to see the state being mutated here
It's inconsistent with React, where you shouldn't mutate state directly
The pitfalls of immer means it actually adds more complexity. E.g. you have to remember to either mutate directly or return a new state but not both.
Please consider adding an option to remove it.
The text was updated successfully, but these errors were encountered: