We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
setState() -> Store.dispath()
setState()
Store.dispath()
Redux 试图让 state 的变化变得可预测。
component -> action -> reducer -> state
component
action
reducer
state
Action 是把数据从应用传到 store 的有效载荷。它是 store 数据的唯一来源。一般来说你会通过 store.dispatch() 将 action 传到 store。
store.dispatch()
{ type: '...', payload: { ... } }
(previousState, action) => newState
state 是一棵树。
let store = createStore( reducers )
store.getState()
store.dispatch( action )
store.subscribe( listener )
store.replaceReducer( nextReducer )
In Depth Overview
(state, action) => state
register(function callback)
dispatch(object payload)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Redux
setState()
->Store.dispath()
Redux 试图让 state 的变化变得可预测。
参考资源
核心概念
component
->action
->reducer
->state
把数据从应用传到 store 的有效载荷。
指明应用如何更新 state。
使用 action 来描述『发生了什么』,使用 reducers 来根据 action 更新 state,Store 把它们联系到一起的。
三大原则
整个应用的 state 被储存在一棵 object tree 中,并且这个 object tree 只存在于唯一一个 store 中。
惟一改变 state 的方法就是触发 action,action 是一个用于描述已发生事件的普通对象。
为了描述 action 如何改变 state tree ,你需要编写 reducers。
Action
Action 是把数据从应用传到 store 的有效载荷。它是 store 数据的唯一来源。一般来说你会通过
store.dispatch()
将 action 传到 store。Reducer
Store
state 是一棵树。
let store = createStore( reducers )
store.getState()
store.dispatch( action )
store.subscribe( listener )
store.replaceReducer( nextReducer )
Flux
In Depth Overview
(state, action) => state
register(function callback)
dispatch(object payload)
Actions
数据范式化
The text was updated successfully, but these errors were encountered: