title: Connecting NextJS, next-i18next, with-redux, with-redux-saga: "Error: If you have a getInitialProps method in your custom _app.js file..."
body: <p>I'm trying to connect a functioning NextJS/React app that uses 'with-redux-saga' and 'with-redux' to 'next-i1iN' (<a href="https://github.com/isaachinman/next-i18next" rel="nofollow noreferrer">https://github.com/isaachinman/next-i18next</a>) --  but when my app boots I get the following error:</p>
  
  <blockquote>
    <p>Error: If you have a getInitialProps method in your custom _app.js
    file, you must explicitly return pageProps. For more infor  mation,
    see: <a href="https://github.com/zeit/next.js#custom-app" rel="nofollow noreferrer">https://github.com/zeit/next.js#custom-app</a></p>
    
    <p>TypeError: Cannot read property 'namespacesRequired' of undefined
        at Function.getInitialProps (/Users/cerulean/Documents/Projects/PAW-React/node_modules/next-i18next/dist/hocs/app-with-translation.js:94:57)
        at process._tickCallback (internal/process/next_tick.js:68:7)</p>
  </blockquote>
  
  <p>But I am returning page props in my <code>_app.js</code>.</p>
  
  <pre><code>// _app.js
   static async getInitialProps({ Component, ctx }) {
  
      const pageProps = {};
      let temp;
  
      if (Component.getInitialProps) {
        temp = await Component.getInitialProps({ ctx });
      }
      Object.assign(pageProps, temp);
      return { ...pageProps };
    }
  </code></pre>
  
  <p>Perhaps there is something wrong with how I am hooking together the various HOCs?  In <code>_app.js</code> I have:</p>
  
  <pre><code>export default withRedux(createStore, { debug: false })(withReduxSaga({ async: true })(i18nInstance.appWithTranslation(MyApp)));
  </code></pre>
  
  <p>And in my <code>index.js</code> I have:</p>
  
  <pre><code>   // index.js
  const mapStateToProps = (state) =&gt; ({ homeData: getHomePageData(state) });
  
  export default connect(mapStateToProps)(withNamespaces('common')(Index));
  </code></pre>
  
  <p>Any insights much appreciated!</p>