我使用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 = {};
空没有触发任何警告?