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

React & Redux #55

Open
vvLavida opened this issue Oct 11, 2016 · 0 comments
Open

React & Redux #55

vvLavida opened this issue Oct 11, 2016 · 0 comments

Comments

@vvLavida
Copy link
Owner

vvLavida commented Oct 11, 2016

React Native 使你能够基于 JavaScript 和 React 在原生平台上构建应用,提倡的是 “learn once, write anywhere”,复用代码,提高开发效率。

React

React 将应用分为一个个动态可复用的组件 —— View的渲染(JSX)、数据如何绑定到显示、状态的变更(State)、属性(Props)都包含在组件内部。
整个应用由一个个组件搭积木而成(组件式开发),而每个组件则由状态驱动而变更。

Redux

Redux 本身和 React 并没有特别紧密的联系,而是 Facebook 提出的 Flux 架构的一种优秀实现,可以搭配其他任何框架一起使用。在 React 上使用,需要搭配 react-redux(如此一来 Redux 可以不局限于 React,而让社区发展出更多的 redux-* 中间件)。

Redux 在 React 的基础上(state 和 props),增加了 store、action、reducer 的概念,规范了全局一个 state,从而只需要根据这个 state 就能回朔出整个应用的状态。组件通过 dispatch 将 action 传到 store,reducer 根据原来的 state 以及 action,返回新的 state,组件根据新的 state 渲染界面。

Redux 是一个可预测的状态容器,即只需要有状态树,就能还原出“事发现场”。

React Native for Mobile

从零开始的Android新项目10 - React Native & Redux

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