JSFiddle - React, Tailwind, and code Playground
HTML
<form id="formulario">
<input type="text" id="campo">
<input type="submit" value="Enviar">
</form>
JavaScript
var form = document.getElementById('formulario');
var campo = document.getElementById('campo');
form.addEventListener('submit', function(e) {
// alerta o valor do campo
alert(campo.value);
// impede o envio do form
e.preventDefault();
});