title: How to persist redux state data in Next.js?
body: <p>I've recently set up the redux with my Next.js project, now i'm dealing with persisting redux data, so that on every page refresh, i can have the persist state. So i've added redux-persist for handling this scenario as it's the best solution with react-redux, but I don't know why it's not working here in next.js with next-redux-wrapper or withRedux library too. So kindly help me with this issue, is there anything like redux-persist existed ?(I don't want cookie's solution though), if yes, then kindly suggest me the references with examples, it will be really helpful. Thanks in advance...</p>
  
  <p>I was actually trying to persist the redux state after every page refreshes, so i have used redux-persist with next-redux-wrapper too, but i'm getting errors</p>
  
  <p>/store.js</p>
  
  <pre><code>    import { createStore, applyMiddleware } from 'redux'
      import { composeWithDevTools } from 'redux-devtools-extension'
      import thunkMiddleware from 'redux-thunk'
      import { persistReducer } from 'redux-persist';
      import storage from 'redux-persist/lib/storage';
  
      const persistConfig = {
        timeout: 0,
        key: 'root',
        storage,
      };
      const persistedReducer = persistReducer(persistConfig, reducer);
  
      export default () =&gt; {
        return createStore(persistedReducer,
          composeWithDevTools(
            applyMiddleware(
              thunkMiddleware
            )
          ));
      };
  </code></pre>
  
  <p>/_app.js</p>
  
  <pre><code>    import App, { Container } from 'next/app'
      import React from 'react'
      import { Provider } from 'react-redux'
      import withRedux from 'next-redux-wrapper';
      import { PersistGate } from 'redux-persist/integration/react';
      import { persistStore } from 'redux-persist';
      import store from '../store';
  
      class MyApp extends App {
        static async getInitialProps ({Component, ctx}) {
          return {
            pageProps: (Component.getInitialProps ? await Component.getInitialProps(ctx) : {})
          };
        }
  
        render () {
          const { Component, pageProps, reduxStore } = this.props;
          const persistor = persistStore(store);
          return (
            &lt;Container&gt;
              &lt;Provider store={store}&gt;
              &lt;PersistGate loading={null} persistor={persistor}&gt;
                  &lt;Component {...pageProps} /&gt;
                &lt;/PersistGate&gt;
              &lt;/Provider&gt;
            &lt;/Container&gt;
          )
        }
      }
  </code></pre>
  
  <p>I expect it will persist the state, but I'm getting error like this : "redux-persist failed to create sync storage. falling back to memory storage.TypeError: baseReducer is not a function"</p>