Next.js: Router.push with state : <p>I'm using next.js for rebuilding an app for server side rendering.
I have a button that handles a search request.</p>

<p>In the old app, the handler was this one:</p>

<pre><code>search = (event) =&gt; {
    event.preventDefault();
    history.push({
        pathname: '/results',
        state: {
            pattern: this.state.searchText,
        }
    });
}
</code></pre>

<p>In the results class, I could get the state date with this.props.location.state.pattern.</p>

<p>So now I'm using next.js:</p>

<pre><code>import Router, { withRouter } from 'next/router'

performSearch = (event) =&gt; {
    event.preventDefault();
    Router.push({ pathname: '/results', state: { pattern: this.state.searchText } });
};
</code></pre>

<p>In the results class, I use </p>

<pre><code>static async getInitialProps({req}) {
    return req.params;
}
</code></pre>

<p>I'm not sure if I have to add this to my server.js:</p>

<pre><code>server.get('/results', (req, res) =&gt; {
    return app.render(req, res, '/results', req.params)
})
</code></pre>

<p>However, the function getInitialProps throws an error because req is undefined. Long text, short question: how to pass state or params to another page without using GET parameters?</p>
