Redux бросает меня:
Ошибка: ожидаемая функция редуктора.
в строках
из индекса:
const { store } = configureStore();
из configureStore:
const store = createStore(rootReducer, initialState, devToolsEnhancer())
index.js
import React from 'react';
import { render } from 'react-dom';
import Root from './Root';
import './index.css';
import App from './whitesheet-components/App';
import registerServiceWorker from './registerServiceWorker';
import configureStore from './store/configureStore';
const { store } = configureStore();
const MOUNT_NODE = document.getElementById('root');
const load = Component =>
render(
<App>
<Component store={store} />
</App>,
MOUNT_NODE,
);
load(Root);
registerServiceWorker();
configureStore.js
import { createStore } from 'redux';
import { devToolsEnhancer } from 'redux-devtools-extension';
import rootReducer from './rootReducer';
const isDevelopment = process.env.NODE_ENV !== 'production';
export default function configureStore(initialState = {}) {
const store = createStore(rootReducer, initialState, devToolsEnhancer());
if (isDevelopment && module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('./rootReducer.js', () => {
const nextReducer = require('./rootReducer').default; // eslint-disable-line global-require
store.replaceReducer(nextReducer);
});
}
return { store };
}
rootReducer
import mockReducer from './mockReducer';
export default { mockReducer };
mockReducer
export default function reducer(state = { hola: 'as' }, { type }) {
switch (type) {
default:
return state;
}
}
Не могу найти ошибку. Впервые создаю магазин при помощи плагинов devtools