JSFiddle - React, Tailwind, and code Playground

HTML

<form id='mySuperDuperForm' action="/echo/json" method="post" onsubmit="submitHandler(event)">
  <input value="press" type="text">
  <button>
  Press
  </button>
</form>

JavaScript

var submitHandler = (event) => {
  console.log('test')
  event.preventDefault()
  console.log('before')
  new Promise((res, rej) => {
    setTimeout(function() {
      console.log('ajax done')
      res()
    }, 1400);
  }).then(() => {
    /*
    Okay let me level with you... this is weird shit. 
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
    Calling submit on the html form element doesn't call the onsubmit handler.
    So we're relying on that specification oddity to submit the form as if it doesn't         have a cusom onsubmit handler here
    */
  	document.querySelector('#mySuperDuperForm').submit()
  })
	
  console.log('after')
}