23 lines
603 B
JavaScript
23 lines
603 B
JavaScript
import { createStore, applyMiddleware } from 'redux';
|
|
import thunk from 'redux-thunk';
|
|
import logger from 'redux-logger';
|
|
import rootReducer from '../reducers/rootReducer';
|
|
|
|
let middleware = [thunk];
|
|
|
|
if (__DEV__) {
|
|
/* eslint-disable global-require */
|
|
const reduxImmutableStateInvariant = require('redux-immutable-state-invariant').default();
|
|
middleware = [...middleware, reduxImmutableStateInvariant, logger];
|
|
} else {
|
|
middleware = [...middleware];
|
|
}
|
|
|
|
export default function configureStore(initialState) {
|
|
return createStore(
|
|
rootReducer,
|
|
initialState,
|
|
applyMiddleware(...middleware)
|
|
);
|
|
}
|