{"size": 1048, "ext": "js", "max_stars_repo_path": "app/redux/store/configure.js", "max_stars_repo_name": "AdamSalma/MemeScape", "max_stars_repo_stars_event_min_datetime": "2016-11-17T15:35:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-20T10:45:24.000Z", "max_issues_repo_path": "app/redux/store/configure.js", "max_issues_repo_name": "AdamSalma/MemeScape", "max_issues_repo_issues_event_min_datetime": "2017-06-04T23:37:44.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T11:41:48.000Z", "max_forks_repo_path": "app/redux/store/configure.js", "max_forks_repo_name": "AdamSalma/MemeScape", "max_forks_repo_forks_event_min_datetime": "2021-01-02T22:22:52.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-11T16:53:42.000Z"}
{"max_stars_count": 19, "max_issues_count": 20, "max_forks_count": 4, "avg_line_length": 25.5609756098, "max_line_length": 67, "alphanum_fraction": 0.6784351145}
import { createStore, applyMiddleware, compose } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import rootReducer from '../reducers';

export default function configureStore(initialState) {
  // This is for a chrome addon called redux devtools. Very useful.
  const composeEnhancers =
        window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose

  const middleware = [ thunkMiddleware ];

  if (process.env.NODE_ENV === `development`) {
    const { logger } = require(`redux-logger`);

    middleware.push(createLogger({
      collapsed: true,
      duration: true,
      diff: true
    }));
  }

  const store = createStore(
    rootReducer,
    initialState,
    composeEnhancers(
      applyMiddleware(...middleware)
    )
  );

  if (module.hot) {
    // Enable Webpack hot module replacement for reducers
    module.hot.accept('../reducers', () => {
      const nextRootReducer = require('../reducers').default
      store.replaceReducer(nextRootReducer)
    })
  }

  return store
}
