首页 > 解决方案 > mobx 的 createTransformer 和 mobx-utils computedFn 有什么区别?

问题描述

mobx 的 createTransformer 和 mobx-utils computedFn 有什么区别?

有时在 mobx 和 mobx-utils 中的事物之间存在重叠(即 whenWithTimeout),但是当我过去看到后者已被标记为已弃用时。查看 computedFn 的实现,它似乎可以做一些额外的事情来观察传递给 computedFn() 结果的参数。不过我不确定。

https://mobx.js.org/refguide/create-transformer.htmlhttps://github.com/mobxjs/mobx-utils#computedfn

标签: mobxmobx-utils

解决方案


来自https://github.com/mobxjs/mobx-utils/issues/199

createTransformer不需要“主机”来存储它的状态。如果你可以利用computedFn,我会的。


推荐阅读