Unable to rebuild a form in submit handler I don't have much experience in drupal development. So for the purpose of learning, i have made a custom module and trying to implement various functionalities in drupal 8 module development. 
I want to rebuild a form on submission of the form. I took help from here and here and drupal.org's this node. How can i rebuild the form on clicking on the button 'Click Me'. It is not throwing any error but the form is not getting rebuild in the following piece of code :

function say_hello_submit(&amp;$form, &amp;$form_state) {

    $form_state-&gt;setRebuild();
  }
public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this-&gt;config('hugs.settings');

    $form['default_count'] = [
        '#type' =&gt; 'number',
        '#title' =&gt; $this-&gt;t('Default_hug_count'),
        '#default_value' =&gt; $config-&gt;get('default_count'),
    ];
    $form['mytable'] = [
        '#type' =&gt; 'table',
        '#header' =&gt; [t('Name'), t('Value')],
        '#rows' =&gt; array(),
    ];
    for ($i=1; $i&lt;=2; $i++) {
        $form['mytable'][$i]['name'] = array(
            '#type' =&gt; 'textfield',
            '#size' =&gt; 40,
            '#maxlength' =&gt; 40,
            '#title' =&gt; t('Name'),
             '#title_display' =&gt; 'invisible',
     );

        $form['mytable'][$i]['value'] = array(
            '#type' =&gt; 'textfield',
            '#size' =&gt; 40,
            '#maxlength' =&gt; 40,
            '#title' =&gt; t('Value'),
            '#title_display' =&gt; 'invisible',
     );
    }
    $form['submit'] = array('#type' =&gt; 'submit', '#value' =&gt; 'Click Me');
    $form['#submit'][] = 'say_hello_submit' ;

    return parent::buildForm($form, $form_state);

}
What exactly do you expect to happen when it's "rebuilding"?

I should simply call buildForm() again, but that will build the same form, so visually, you won't see a difference. The only ondication would be that it's doing only a POST request, while a non-rebuilding form submission does a redirect to the same page after submitting.

If you e.g. want to see additional rows in your list, you need to store the desired max with $form_state-&gt;set('max_rows, 5) and then in your buildForm() method, read it again from there with get()