JSFiddle - React, Tailwind, and code Playground

HTML

<input>

JavaScript

$("input").on("keydown", function (e) {
    return e.which !== 32;
});