JSFiddle - React, Tailwind, and code Playground
HTML
<form id="userInput" action="#" method="post">
<input type="text">
</form>
JavaScript
$('#userInput').keypress(function(event) {
if (event.which == 13) {
alert("run function here");
event.preventDefault();
}
});