【问题标题】:Difference between: MobX and Redux [closed]区别:MobX 和 Redux [关闭]
【发布时间】:2018-10-02 03:53:20
【问题描述】:
  • 有什么区别?
  • 在 React 或 React-Native 中,MobX 和 Redux 之间有什么更好的库,直到从小到大的大型项目?

【问题讨论】:

  • 单存储 vs 多存储纯数据 vs 可观察数据 可变 vs 不可变
  • 我对这个问题的回答 (stackoverflow.com/a/51813683/741657) 可能会帮助您更好地理解。 (也阅读问题,了解上下文)

标签: reactjs react-native redux mobx


【解决方案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

【讨论】:

  • 答案列出了其他人的答案,没有署名。代码 sn-p 不是格式化常规文本的正确方法。图片的格式应为图片,而不是链接,最好带有它们来自的链接。
【解决方案2】:

它们之间的主要区别在于,Redux 中有很多样板代码,而 Mobx 可以帮您省去这些代码(在内部,它会以尽可能最佳和最优的方式为您完成)。与 MobX 相比,Redux 在定义数据流时为您提供了很大的灵活性。

【讨论】:

    猜你喜欢
    • 2020-05-29
    • 2016-10-28
    • 2021-03-07
    • 1970-01-01
    • 2018-10-21
    • 2016-08-03
    • 2012-12-16
    • 2011-12-30
    • 2014-11-01
    相关资源
    最近更新 更多