mobx - mobx 的 createTransformer 和 mobx-utils computedFn 有什么区别?
问题描述
mobx 的 createTransformer 和 mobx-utils computedFn 有什么区别?
有时在 mobx 和 mobx-utils 中的事物之间存在重叠(即 whenWithTimeout),但是当我过去看到后者已被标记为已弃用时。查看 computedFn 的实现,它似乎可以做一些额外的事情来观察传递给 computedFn() 结果的参数。不过我不确定。
https://mobx.js.org/refguide/create-transformer.html和https://github.com/mobxjs/mobx-utils#computedfn
解决方案
来自https://github.com/mobxjs/mobx-utils/issues/199
createTransformer
不需要“主机”来存储它的状态。如果你可以利用computedFn
,我会的。
推荐阅读
- r - memory.limit() 坏了吗?
- python - 是否有一个函数可以帮助我将 (x) 拆分为一个字符串,每个拆分都包含第 (x+1) 个值?
- java - 如何在异步任务的 for 循环中更新列表视图
- android - windowBackground 上的居中图像与膨胀布局上的图像不同
- python - 无法从 __init__ 导入属性
- python - 施加约束时问题不遵循 DCP 规则
- mysql - 为什么 Google Cloud SQL 中的 COUNT 有时会这么慢?
- google-app-maker - 如何使用计算模型将数据保存到 REST API
- playframework - 一个灵活的扩展方法的多对多版本
- javascript - 在被测函数内部创建的对象上模拟 jQuery 方法调用