Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

什么时候该用 Redux,四张图片告诉你 #245

Open
GuoYongfeng opened this issue Dec 6, 2017 · 0 comments
Open

什么时候该用 Redux,四张图片告诉你 #245

GuoYongfeng opened this issue Dec 6, 2017 · 0 comments

Comments

@GuoYongfeng
Copy link
Member

GuoYongfeng commented Dec 6, 2017

原文地址:https://medium.com/dailyjs/when-do-i-know-im-ready-for-redux-f34da253c85f

使用React组件自身的 state 进行数据传递

image

通过状态提升来解决非父子组件的数据传递

image

页面中多组件间的数据传递

这个时候可以考虑来个EventBus事件机制,或开始考虑 Redux了

image

如果你的应用中出现了这些情况,Redux或是mobx等状态管理方案可以上场了

  • UI 可以根据应用程序状态变化
  • 许多不相关的组件以相同的方式更新状态
  • 状态树相对较为复杂了
  • 状态以许多不同的方式更新

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant