title: Next.js search/filtering form
body: <p>I am new to React and Next.js and during learning this libraries I encountered this difficulty. </p>
  
  <p>I am trying to make a filterable table with some fetched data.</p>
  
  <p>Data from API is loaded on server side through <code>getInitialProps()</code> method.</p>
  
  <pre class="lang-js prettyprint-override"><code>static async getInitialProps(context) {
  
          const elements = await getElements()
  
          return {
              elements: elements,
          }
  }
  </code></pre>
  
  <p>Then I am rendering Bootstrap table with data and filtering form. Simplified example:</p>
  
  <pre class="lang-js prettyprint-override"><code>render() {
          return (
              &lt;div&gt;
                 &lt;Form&gt;
                     &lt;FilterInput name="name"&gt;&lt;/FilterInput&gt;
                     &lt;FilterInput name="surnname"&gt;&lt;/FilterInput&gt;
                     &lt;SearchButton&gt;&lt;/SearchButton&gt;
                 &lt;/Form&gt;
                 &lt;table&gt;
                     &lt;tr&gt;
                       &lt;th&gt;Name&lt;/th&gt;
                       &lt;th&gt;Surname&lt;/th&gt;
                     &lt;/tr&gt;
                     {this.props.elements.map((element, index) =&gt; (
                       &lt;tr&gt;
                          &lt;td&gt;
                             {element.name}
                          &lt;/td&gt;
                          &lt;td&gt;
                             {element.surname}
                          &lt;/td&gt;
                       &lt;/tr&gt;
                     )}
                 &lt;/table&gt;
              &lt;div&gt;
          )
  }
  </code></pre>
  
  <p>My first idea was to handle search form submit event, get search inputs values and redirect user to the page with url like this:
  <code>http://localhost:3000/elements?name=enetered_name&amp;surname=enetered_surname</code></p>
  
  <p>Then retrieve query string params from <code>context</code> variable in <code>getInitialProps</code>, pass this params to <code>getElements</code> method and fetch it again from API but now with additional filters. But this solution worked only on first page reload (from server).</p>
  
  <p>My guts are telling me that this is not right solution and I am overcomplicating this. I dont want working code from You. I only need tips and guide how to work this out.</p>