import { createStore, combineReducers } from 'redux'
const reducer = (state = {}, action) => state
const rootReducer = combineReducers(reducer)
let store = createStore(rootReducer)
export default store
创建商店时会触发警告:
Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.
当我尝试使用任何商店方法时,会再次出现此警告。
答案 0 :(得分:5)
错误很简单 - 您没有将对象传递给combineReducers:
const rootReducer = combineReducers({ reducer })
这将解决问题。