text: import { applyMiddleware, compose, createStore } from 'redux';
  import thunkMiddleware from 'redux-thunk';
  import { composeWithDevTools } from 'redux-devtools-extension';
  import rootReducer from './reducers';
  
  const configureStore = (preloadedState) => {
    const middleware = [thunkMiddleware];
    const middlewareEnhancer = applyMiddleware(...middleware);
    const enhancers = [middlewareEnhancer];
    const composedEnhancers = (process.env.NODE_ENV === 'development')
      ? composeWithDevTools(...enhancers) : compose(...enhancers);
    const store = createStore(rootReducer, {}, composedEnhancers);
  
    if (process.env.NODE_ENV !== 'production' && module.hot) {
      module.hot.accept(
        './reducers',
        () => store.replaceReducer(rootReducer)
      );
    }
  
    return store;
  };
  
  export default configureStore;
  