title: Can't add tracing functionality in Redux with Next.js
body: <p>I'd like to add the <a href="https://github.com/zalmoxisus/redux-devtools-extension/commit/64717bb9b3534ff616d9db56c2be680627c7b09d" rel="nofollow noreferrer">tracing functionality</a> to my dev tools in Redux:</p>
  
  <p>However I when doing this:</p>
  
  <pre><code>export default () =&gt; {
    let store;
    const isClient = typeof window !== 'undefined';
    if (isClient) {
      const { persistReducer } = require('redux-persist');
      const storage = require('redux-persist/lib/storage').default;
      const persistConfig = {
        key: 'root',
        storage,
        stateReconciler: autoMergeLevel2,
  
        whitelist: ['users', 'ui'] // place to select which state you want to persist
      };
  
     ******composeEnhancers******
  
      var composeEnhancers =
        typeof window === 'object' &amp;&amp; window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
          ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
              // Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
            })
          : compose;
  
      composeEnhancers = composeWithDevTools({
        actionCreators,
        trace: true,
        traceLimit: 25
      });
  
      store = createStore(
        persistReducer(persistConfig, rootReducer),
        composeEnhancers(
          applyMiddleware(thunkMiddleware, createLogger({ collapsed: false }))
        )
      );
  
    ******composeEnhancers******
  
      store.__PERSISTOR = persistStore(store);
    } else {
      store = createStore(
        rootReducer,
        composeEnhancers(
          applyMiddleware(thunkMiddleware, createLogger({ collapsed: false }))
        )
      );
    }
    return store;
  };
  </code></pre>
  
  <p>I get the following error...</p>
  
  <pre><code>Unhandled Runtime Error
  TypeError: composeEnhancers is not a function
  
  Call Stack
  module.exports../store/index.js.__webpack_exports__.default
  file:///Users/antonio-pavicevac-ortiz/Dropbox/developer_folder/hillfinder/.next/server/static/development/pages/_app.js (499:84)
  createStore
  file:///Users/antonio-pavicevac-ortiz/Dropbox/developer_folder/hillfinder/node_modules/next-redux-wrapper/lib/index.js (95:20)
  initStore
  file:///Users/antonio-pavicevac-ortiz/Dropbox/developer_folder/hillfinder/node_modules/next-redux-wrapper/lib/index.js (98:20)
  Object.&lt;anonymous&gt;
  file:///Users/antonio-pavicevac-ortiz/Dropbox/developer_folder/hillfinder/node_modules/next-redux-wrapper/lib/index.js (137:33)
  step
  file:///Users/antonio-pavicevac-ortiz/Dropbox/developer_folder/hillfinder/node_modules/next-redux-wrapper/lib/index.js (56:23)
  Object.next
  file:///Users/antonio-pavicevac-ortiz/Dropbox/developer_folder/hillfinder/node_modules/next-redux-wrapper/lib/index.js (37:53)
  &lt;unknown&gt;
  file:///Users/antonio-pavicevac-ortiz/Dropbox/developer_folder/hillfinder/node_modules/next-redux-wrapper/lib/index.js (31:71)
  new Promise
  &lt;anonymous&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Followed a thread from <a href="https://github.com/reduxjs/redux-toolkit/issues/121" rel="nofollow noreferrer">redux-toolkit</a> and I think I am halfway there,
  but now I am getting the following which seems odd considering my setup:</p>
  
  <pre><code>Error: "reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers
  </code></pre>
  
  <p>This is my updated store:</p>
  
  <pre><code>import { combineReducers } from 'redux';
  import { configureStore } from '@reduxjs/toolkit';
  import { createLogger } from 'redux-logger';
  
  /* imported reducers */
  import ui from './reducers/ui/index';
  import users from './reducers/users/index';
  
  import thunkMiddleware from 'redux-thunk';
  import { persistStore } from 'redux-persist';
  
  import autoMergeLevel2 from 'redux-persist/lib/stateReconciler/autoMergeLevel2';
  import { persistReducer } from 'redux-persist';
  
  var reducers = combineReducers({
    users: users,
    ui: ui
  });
  
  export default () =&gt; {
    let store;
    const isClient = typeof window !== 'undefined';
    if (isClient) {
      var storage = require('redux-persist/lib/storage').default;
      var persistConfig = {
        key: 'root',
        storage,
        stateReconciler: autoMergeLevel2,
  
        whitelist: ['users', 'ui'] // place to select which state you want to persist
      };
  
      var persistedReducer = persistReducer(persistConfig, reducers);
  
      store = configureStore({
        reducer: persistedReducer,
        middleware: [thunkMiddleware, createLogger()]
      });
      store.__PERSISTOR = persistStore(store);
    } else {
      store = configureStore({
        reducer: persistedReducer,
        middleware: [thunkMiddleware, createLogger()]
      });
    }
    return store;
  </code></pre>