import {applyMiddleware, createStore} from 'redux';
import rootReducer from '../reducers';
import thunkMiddleware from 'redux-thunk';

export default function configureStore (initialState) {
  const create = typeof window !== 'undefined' && window.devToolsExtension
    ? window.devToolsExtension()(createStore)
    : createStore;

  const createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(create);

  return createStoreWithMiddleware(rootReducer, initialState);
}

import {applyMiddleware, compose, createStore} from 'redux';
import reducer from '../reducers';
import thunk from 'redux-thunk';

export default function configureStore (initialState) {
  return createStore(
    reducer,
    initialState,
    compose(
      applyMiddleware(thunk),
      typeof window !== 'undefined' && window.devToolsExtension ? window.devToolsExtension() : (f) => f
    )
  );
}

Clean up store using compose
Clean up store using compose
