
React & Immer - GitHub Pages
Deep updates in the state of React components can be greatly simplified as by using Immer. The following example shows how to use produce in combination with useState, and can be tried on …
Installation | Immer - GitHub Pages
To make sure Immer is as small as possible, features that are not required by every project has been made opt-in, and have to be enabled explicitly. This ensures that when bundling your application for …
API overview | Immer - GitHub Pages
Importing immer In most cases, the only thing you need to import from Immer is produce:
Update patterns | Immer - GitHub Pages
Working with immutable data, before Immer, used to mean learning all the immutable update patterns. To help 'unlearning' those patterns here is an overview how you can leverage the built-in JavaScript …
Immer performance - GitHub Pages
By default, Immer uses loose iteration which only processes enumerable string properties. This is faster than strict iteration which includes symbols and non-enumerable properties.
Map and Set | Immer - GitHub Pages
Maps and Sets that are produced by Immer will be made artificially immutable. This means that they will throw an exception when trying mutative methods like set, clear etc. outside a producer.
API 概览 | Immer - GitHub Pages
API 概览 ... 导入 immer produce 作为默认导出,但也可以选择将其用作名称导入,因为这有利于一些较旧的项目设置。 所以下面的导入都是正确的,这里推荐第一个:
使用 produce | Immer - GitHub Pages
关于 Immer 的有趣之处在于 baseState 将保持不变,但 nextState 将反映对 DraftState 所做的所有更改. 在 recipe 中,所有标准的 JavaScript API 都可以在 draft 对象上使用,包括属性字段分配、删除操作 …
安装 | Immer - GitHub Pages
Immer 使用在旧的 JavaScript 环境? 默认情况下, produce 尝试使用代理以获得最佳性能。 但是,在较旧的 JavaScript 引擎上,代理不可用。 例如,在 Android 上运行 Microsoft Internet Explorer 或 …
类 | Immer - GitHub Pages
因为 Immer 会将对象拥有的 getter 解引用到普通属性中,所以可以使用在其字段上使用 getter/setter 获得的对象,就像MobX 和 Vue。 Immer 不支持外来/引擎原生对象,例如 DOM 节点或 Buffers,也不 …