text: import { createStore, applyMiddleware, compose } from 'redux';
  import createSagaMiddleware, { END } from 'redux-saga';
  import createMemoryHistory from 'history/createMemoryHistory';
  import { routerMiddleware } from 'react-router-redux';
  
  import combinedReducers from './../app/rootReducer';
  
  const sagaMiddleware = createSagaMiddleware();
  
  const reduxMiddlewares = [
    routerMiddleware(createMemoryHistory()),
    sagaMiddleware,
  ];
  
  export default (initialState) => {
    const store = createStore(
      combinedReducers,
      initialState,
      compose(applyMiddleware(...reduxMiddlewares)),
    );
  
    store.runSaga = sagaMiddleware.run;
  
    store.close = () => store.dispatch(END);
  
    return store;
  };
  