原src下的store的js文件,运行后报错
import { createStore } from "redux";
const notices = (state = {isAllRead: false,count:8},action)=>{
switch (action.type) {
case "READ_ALL":
return{...state,isAllRead:true};
default:
return state;
}
};
const store = createStore(notices)
export default store ;
报错TypeError: store.getState is not a function
修改以上代码
import { createStore } from "redux";
function notices(state={isAllRead: false,count:8},action){
switch (action.type) {
case 'READ_ALL':
return {...state,isAllRead:true};
default:
break;
}
}
const store = createStore(notices)
export default store ;
可能第一个代码块定义的state方式老了不支持了