action
组件内 dispatch之前直接dispatch({data:xxx,type:xxx}),现在改为dispatch(ACTION)
constant.js: 定义 reducer 和 action中的 type
reducer.js:
action.js:
异步的 action
方法一: 组件内写异步
方法二:store中写
npm install redux-thunk
store.js:
count_action.js:
count.jsx: 组件内调用: