【发布时间】:2018-11-08 07:45:06
【问题描述】:
我已经设置了一个减速器,但是控制台抱怨“动作”没有定义为 no-undef
import { getName } from '../actions';
let defaultState={
name: "Sam"
}
const mainReducer=(state = defaultState, simpleAction)=>{
if (action.type === "CHANGE_NAME") {
return{
...state,
name: action.name
}
} else {
return{
...state
}
}
}
export default mainReducer
【问题讨论】:
-
是
simpleAction -
应该是
(state = defaultState, action)