How do I show the result on same page after submitting the form? How do I show the result on same page after submitting the form in Drupal 8?
Request a rebuild in submitForm() and then display the result in buildForm():

public function buildForm(array $form, FormStateInterface $form_state) {

  // build form

  if ($form_state-&gt;isRebuilding()) {

    // display result

  }
}

public function submitForm(array &amp;$form, FormStateInterface $form_state) {

  $form_state-&gt;setRebuild();

}