我使用https://github.com/stylesuxx/generator-react-webpack-redux的發電機。發展,例外的是我在瀏覽器控制檯減速機爲空時,商店沒有有效的減速機
warning.js:10 Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.
錯誤在index.js
在減小文件罰款去,代碼如下陳述:
import { combineReducers } from 'redux';
const reducers = {};
const combined = combineReducers(reducers);
module.exports = combined;
在index.js
中存儲文件,代碼如下所示:
import { createStore } from 'redux';
import reducers from '../reducers';
function reduxStore(initialState) {
const store = createStore(reducers, initialState,
window.devToolsExtension && window.devToolsExtension());
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers',() => {
// We need to require for hot reloading to work properly.
const nextReducer = require('../reducers'); // eslint-disable-line global-require
store.replaceReducer(nextReducer);
});
}
return store;
}
export default reduxStore;
我沒有在當前的開發中使用redux,但我使用了gener ator進行配置以供將來進行規劃。任何想法如何使減速器像上面的代碼const reducers = {};
空沒有觸發任何警告?