为什么使用Redux而不是Facebook Flux? [关闭]

匆匆过客 提交于 2020-08-18 14:10:39

问题:

I've read this answer , reducing boilerplate , looked at few GitHub examples and even tried redux a little bit (todo apps). 我已经阅读了这个答案减少了样板 ,看了几个GitHub示例,甚至尝试了redux(todo apps)。

As I understand, official redux doc motivations provide pros comparing to traditional MVC architectures. 据我了解, 官方redux doc动机提供了与传统MVC架构相比的优点。 BUT it doesn't provide an answer to the question: 但它没有提供问题的答案:

Why you should use Redux over Facebook Flux? 为什么你应该使用Redux而不是Facebook Flux?

Is that only a question of programming styles: functional vs non-functional? 这只是编程风格的问题:功能与非功能? Or the question is in abilities/dev-tools that follow from redux approach? 或者问题是在redux方法中遵循的能力/开发工具? Maybe scaling? 也许缩放? Or testing? 还是测试?

Am I right if I say that redux is a flux for people who come from functional languages? 如果我说redux对于来自函数式语言的人来说是一种变化,我是对的吗?

To answer this question you may compare the complexity of implementation redux's motivation points on flux vs redux. 要回答这个问题,您可以比较实施redux在flux和redux上的动机点的复杂性。

Here are motivation points from official redux doc motivations : 以下是官方redux doc动机的动机点:

  1. Handling optimistic updates ( as I understand, it hardly depends on 5th point. Is it hard to implement it in facebook flux? ) 处理乐观的更新( 据我所知,它几乎不取决于第5点。难道在facebook flux中实现它吗?
  2. Rendering on the server ( facebook flux also can do this. Any benefits comparing to redux? ) 在服务器上渲染( facebook flux也可以做到这一点。与redux相比有什么好处?
  3. Fetching data before performing route transitions ( Why it can't be achieved in facebook flux? What's the benefits? ) 在执行路由转换之前获取数据( 为什么在facebook中无法实现?有什么好处?
  4. Hot reload ( It's possible with React Hot Reload . Why do we need redux? ) 热重载( 可以使用React Hot Reload 。为什么我们需要redux?
  5. Undo/Redo functionality 撤消/重做功能
  6. Any other points? 还有其他一点吗? Like persisting state... 像坚持国家一样......

解决方案:

参考一: https://stackoom.com/question/2CCeD/为什么使用Redux而不是Facebook-Flux-关闭
参考二: https://oldbug.net/q/2CCeD/Why-use-Redux-over-Facebook-Flux-closed
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!