JSFiddle - React, Tailwind, and code Playground

HTML

<input id="input">

JavaScript

var timer;
$("#input").on("keydown input", function(){
    var self = this;
    clearTimeout(timer)
    // this allows the value to update if the event is keydown, doesn't harm input event either.
    timer = setTimeout(function(){
        console.log(self.value);
    },0);
});