为什么不应该将MobX用作状态容器? [英] Why should MobX not be used as a State Container?

查看:86
本文介绍了为什么不应该将MobX用作状态容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不应该将MobX用作状态容器?如官方文档所述"MobX不是状态容器"?不像Redux吗?

Why should MobX not be used as a State Container? as mentioned in the official docs "MobX is not a state container"? Isn't is like Redux?

推荐答案

与MobX状态树I相比,Redux更好,考虑到类似的动作分配模式,工具等.MobX对如何导出新状态不提供任何限制.从旧的.它更像是数据流库,因为其创建者喜欢调用它.

Redux is better compared with MobX State Tree I, considering the similar action dispatch pattern, tooling etc. MobX does not provide any restrictions on how new states can be derived from old ones. It's more of a Data flow library as its creator likes to call it.

MobX帮助我们在React组件之外设置反应性.这样,视图组件可以保持逻辑.但是,MST确实使状态管理变得更容易且切实可行.由于状态的引入,它还提供了Redux之类的devtools.因此,MST可以比MobX更好地替代Redux.

MobX helps us set up Reactivity outside React components. This way view components can be kept free of logic. But it is MST that truly makes state management easier and realistically doable. It also provides devtools like Redux thanks to the introduction of types in the state. So MST would qualify as an alternative to Redux better than MobX.

检查原始帖子为何选择MobX状态树已创建,并且如何补充MobX作为完整的状态管理工具.

Check the original post on why MobX State tree was created and how it complements MobX as a complete state management tool.

这篇关于为什么不应该将MobX用作状态容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆