JSFiddle - React, Tailwind, and code Playground

by Josh Krauth-Harding

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}`;
}