Redux 简易理解
2016-03-07 本文已影响0人
Angrybaby
搞了几天都没完全搞明白redux,所以做下笔记
入门教程推荐一个官方文档:
http://camsong.github.io/redux-in-chinese/index.html
redux主要的思想是
store:一般只有一个,主要用来管理state
action:个人理解是,声明一个函数,向外说明有这个函数的存在
函数实现的逻辑建议写在该文件
type表示要执行的动作,一般再带参数返回
![](https://img.haomeiwen.com/i1347028/85090d4aa73c9c67.png)
reducer:根据action返回的值更新state
![](https://img.haomeiwen.com/i1347028/773aca2adedd70e0.png)
combineReducers 可以实现多个reducer
![](https://img.haomeiwen.com/i1347028/6675fda2a42876a0.png)