Open araera111 opened 5 months ago
import statement of immer in v9
import produce from "immer";
import statement of immer in v10
import { produce } from "immer";
If produce can be used instead of create, it will work for most patterns for v10 immer that do not use immer's special features.
I read the documentation and learned that there is a wrapper called mutative-compat. Sorry for creating the issue without reading the documentation.
However, I also feel that my project does not want to add the wrapper as a dependency.
Install mutative and change the import statement. It is easy if that is all it takes to complete the migration. We believe that the number of users will increase.
How do you feel about adding such an API for quickly migrating from Immer to Mutative?
- import { produce } from "immer";
+ import { produce } from "mutative/migrate-immer";
It is important to note that Immer and Mutative have significant differences in their configurations, and therefore they cannot be considered completely equivalent.
I think it is an excellent proposal. If implemented, it would make the transition easier.
I think a lot of people, myself included, are using just "produce". I think it would be great if just changing the library would increase the processing speed.
hi @exuanbo , it might be possible to implement a migration API similar to mutative-compat
in Mutative. What are your thoughts on this?
@exuanbo I'll probably be working on the proposal using mutative-compat
over the next few days. If you've got any thoughts or feedback, don't hesitate to reach out anytime.
The basic syntax is the same, so when changing from immer to mutative, it is only necessary to replace the import statement.
I haven't looked at the source code, but I think it would be as simple as adding the following one sentence.