//@flow

import { createStore, compose, applyMiddleware } from "redux";
import { routerMiddleware } from "react-router-redux";
import createHistory from "history/createBrowserHistory";
import reducers from "./data/reducers";

const defaultState = {};
export const history = createHistory();

const middlewares = [routerMiddleware(history)];

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

  middlewares.push(logger);
}

const enhancers = compose(
  window.devToolsExtension ? window.devToolsExtension() : f => f,
  applyMiddleware(...middlewares)
);

const store = createStore(reducers, defaultState, enhancers);

export default function configureStore() {
  const store = createStore(reducers, defaultState, enhancers);

  if (module.hot) {
    module.hot.accept(reducers, () => {
      const nextRootReducer = require("./data/reducers").default;
      store.replaceReducer(nextRootReducer);
    });
  }
}

//@flow

import { createStore, compose, applyMiddleware } from "redux";
import { routerMiddleware } from "react-router-redux";
import createHistory from "history/createBrowserHistory";
import reducers from "./data/reducers";
import cards from "./data/state/cards";

const defaultState = { cards };
export const history = createHistory();

const middlewares = [routerMiddleware(history)];

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

  middlewares.push(logger);
}

const enhancers = compose(
  window.devToolsExtension ? window.devToolsExtension() : f => f,
  applyMiddleware(...middlewares)
);

const store = createStore(reducers, defaultState, enhancers);

if (module.hot) {
  module.hot.accept("./data/reducers", () => {
    store.replaceReducer(reducers);
  });
}

export default store;

Add cards to default state and hot reload reducers
Add cards to default state and hot reload reducers

