JSFiddle - React, Tailwind, and code Playground
HTML
<input>
<p id="log"></p>
JavaScript
const input = document.querySelector('input');
const log = document.getElementById('log');
input.addEventListener('keydown', logKey);
function logKey(e) {
log.textContent += `${e.key}`;
}