counter
increase
info
todos
为 reducers 文件名
export default combineReducers({ todos, visibilityFilter, increase, counter, info })
初始值 为对应文件 state 初始值 如果在创建 store 时定义初始值 会覆盖 reducer 文件里给与的初始值
/** @Author: winyh* @Date: 2018-06-08 15:54:49* @Last Modified by: winyh* @Last Modified time: 2018-09-29 15:27:01*/const initState = { redirectTo:"", msg:"", username:"", password:"", type:""}
const info = (state = initState, action) => { switch (action.type) { case 'REGISTER_USER': return Object.assign({}, state, "redirectTo":"/boss", "msg":action.text) case 'REGISTER_SUCCESS': return Object.assign({}, state, "msg":action.text) case 'REGISTER_ERROR': return {...state, "msg":action.text} case 'GET_USERINFO': return Object.assign({}, state,action.text) default: return state }}
export default info;