Redux - 总是与 normalizr

Redux - immer vs normalizr

我用过immer in the past and really enjoyed it. It makes using redux a breeze. I recently found out about normlizr,看起来也不错。

两者有什么区别? immer 是否提供与 normalizr 相同的标准化解决方案?对于生产应用程序,两者中哪个更好?还是应该一起使用?

它们是两个完全不同的工具,可以一起使用。

Immer 是一个库,用于在编写“可变”语法时对数据执行不可变更新。

Normalizr 是一个库,用于获取多种类型的嵌套数据(例如包含 UserCommentsPost),并将它们全部提取到一组规范化的查找表。

它们都常用于 Redux 应用程序。

Our official Redux Toolkit package already has Immer built-in. RTK also comes with a createEntityAdapter API for storing and updating normalized data, which uses Immer internally, and we specifically have a usage guide section on pre-processing response data with Normalizr and then handling it with createEntityAdapter