React disable submit event triggered by pressing the enter key

<form
  action="/users/sign_up"
  onSubmit={handleSubmit}
  onKeyPress={event => {
    if (event.which === 13 /* Enter */) {
      event.preventDefault();
    }
  }}
  acceptCharset="UTF-8"
  method="post"
>