Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lowesyang/react-redux-example
Learning Process of redux
https://github.com/lowesyang/react-redux-example
Last synced: 1 day ago
JSON representation
Learning Process of redux
- Host: GitHub
- URL: https://github.com/lowesyang/react-redux-example
- Owner: lowesyang
- License: mit
- Created: 2016-08-25T09:34:56.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-26T10:23:11.000Z (about 8 years ago)
- Last Synced: 2024-08-08T15:24:33.443Z (3 months ago)
- Language: JavaScript
- Size: 282 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-redux-example
react-redux的一个小例子
###tips
* components目录下均为展示组件。
* container目录下的App.jsx为容器组件,属于顶层组件。
* 根目录下的index.jsx为入口文件,即用于加载store注入react的入口。
* reducer的工作流程是(oldState,action)=>newState,注意需要指明默认值。(ES6下可直接对参数赋默认值,较为方便)
* App.jsx中的select(state){}函数中,state成员即为reducer中的各方法,由于它们的返回值也为state,故在初始阶段可引用作为初始的state,然后经connect(select)(App)当作顶层props注入。
* action结构包含一个type与数据域,例如
export function addTodo(text){
return {
type:ADD_TODO,
text //此处为ES6语法,等价于ES5的text:text
}
}