节选翻译 a cartoon intro to redux redux
关于Redux 的数据流的介绍网络
初始化store ,root component 建立 store, 并用 createStore 方法告诉 store 使用那个 root reducer. 这个root reducer 下面已经有多个子reducer. root reducer使用 combineReducer() 来集成子reducer 到 rootReducer 里面.ide
创建 store 和 components 之间的通讯. root component 把传入的 provider 传入的 component 包装成本身的 subcomponent, 而且创建store 和 provider 之间的联系.
Provider 建立了更新component的网络, 那些 smart component 经过connect()接入网络,确保组件state能够及时更新翻译
准备 action 的回调, 这个让一些dumb components 更好的和action工做, smart components 能够使用bindActionCreator() 新建 action 的 callbacks.
这种方式只须要传递一下callback 到dump Components, action 就将自动分发当它整理好后.code
当应用初始化完成后, 用户就能够与之进行交互, 下面将演示用户触发一个action后的数据流程component
视图获取到action. action creator 将其格式化返回.对象
action 要么自动分发(若是bindActionCreators() 在setup中使用到), 要么view 分发该actionget
store 将获取到action, 并将当前的 state tree 和 action 传递给root reducerio
root reducer 把 state tree 砍开多个slice, 并把每一个 slice 传递到相应的 subreducer方法
subreducer 复制一份相同的slice 并在该副本上作出修改, 并返回该处理完的副本到root reducer
当全部的subreducer 返回 它们的slice copies , root reducer 把全部的slices 从新整理成一个新的 state 对象.
store 通知 它绑定的view layer 更新 state的变化
绑定的view layer 通知store 返回新的state 对象
view layer 触发 rerender