We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Store
Action
Reducer
单一数据源
整个应用状态,都应该被存储在单一store的对象树中(object tree)。
State 是只读的
唯一改变state的方法,就是发送(dispatch)一个动作(Action),action 是一个用于描述已发生事件的普通对象
使用纯函数去修改状态
为了描述action 如何改变 state tree,需要写reducers
reducer 只是一些纯函数。。(pure function)可被看成是一个状态机,在任何时候,只要有相同的输入,就会得到相同的输出
function add1(a,b) { return a + b } var a = 0; function add2(b) { return a = a + b } add1(1,2) add1(1,2) add2(1) add2(1)
This is an source code.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
三个概念
Store
Action
Reducer
三大准则
单一数据源
整个应用状态,都应该被存储在单一store的对象树中(object tree)。
State 是只读的
唯一改变state的方法,就是发送(dispatch)一个动作(Action),action 是一个用于描述已发生事件的普通对象
使用纯函数去修改状态
为了描述action 如何改变 state tree,需要写reducers
This is an source code.
The text was updated successfully, but these errors were encountered: