JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="key">

JavaScript

$(function () {
    $('#key').on('keydown', function (event) {
        console.log(event.which);
    });
});