之间的区别:MobX和Redux。

时间:2018-10-02 03:53:21

标签: reactjs react-native redux mobx

  • 有什么区别?
  • MobX和Redux之间的React或React-Native库中有什么更好的库?

2 个答案:

答案 0 :(得分:1)

Redux
•	Large community, so lots of resources available online
•	Conceptually simple, clean abstractions
•	Matured dev tools
•	functional programming oriented, which offers cool benefits like time travelling, trivial action testing and such
•	Actions and state changes are very traceable
•	Rigid paradigm to work in (which is generally speaking a good thing)
MobX
•	Very efficient out of the box (applies side-ways-loading without needing selectors etc)
•	Very suitable for a state tree that has lot of inter data relationships; the data doesn't need to be normalized to a tree
•	More OO oriented; you can use classes, instance methods etc..; less new concepts to learn
•	UI is always kept up to date
•	no flux like action dispatching required (although you could still do that). On large apps this saves tremendous amounts of boilerplate
•	actions are really straightforward; you don't have to return new data structures etc. You can just alter objects and the changes are picked up automatically
•	Functional reactive programming oriented
•	Simpler to work with async actions

Redux

Mobx

答案 1 :(得分:0)

它们之间的主要区别是,Redux中有很多样板代码,而Mobx则从中节省了您的代码(内部以最佳和最佳方式为您完成)。与MobX相比,Redux在定义数据流时为您提供了很大的灵活性。