I'm checking this example in react-hook-form doc: https://codesandbox.io/s/react-hook-form-v6-controller-qsd8r?file=/src/index.js
Weird thing is that the button doesn't have type="submit"
. But it still triggers submit event after clicking.
How does it know which button is the submit button?
<button>
elements are left without eithertype="submit"
or"type="button"
, the latter will always be placed by default no-matter-what, so you'll have multiple buttons being able to submit the form.type="button"
strips the submit ability. – Constantin