title: Does Next.js not need browser history when using Redux?
body: <p>I'm trying to migrate my <code>React</code> app to <code>Next.js</code>. I keep having below error from <code>export const history = createBrowserHistory();</code> in my <code>configureStore.js</code>.</p>
  
  <blockquote>
    <p>Invariant Violation: Browser history needs a DOM</p>
  </blockquote>
  
  <p><strong>configureStore.js</strong></p>
  
  <pre><code>import { createStore, combineReducers, compose, applyMiddleware } from "redux";
  import { connectRouter, routerMiddleware } from "connected-react-router";
  import { createBrowserHistory } from "history";
  import thunk from "redux-thunk";
  import user from "./modules/user";
  import stores from "./modules/stores";
  import info from "./modules/info";
  
  export const history = createBrowserHistory();
  
  const middlewares = [thunk, routerMiddleware(history)];
  
  const reducer = combineReducers({
    user,
    stores,
    info,
    router: connectRouter(history)
  });
  
  export default function configureStore(preloadedState) {
    return createStore(
        reducer,
        preloadedState,
        compose(
          applyMiddleware(
            ...middlewares
          )
        )
      );
  }
  </code></pre>
  
  <p>I've found that many things need to be changed when migrating React to Next.js as Next is a framework which requires its own code architecture as well as the difference between SSR and CSR. When I studied Next.js tutorials, there is a routing section which says that routing is differentiated based on CSR or SSR. Does that mean I cannot use browser history in Next.js? That's what I'm guessting. I'm still confused.</p>