JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text">
JavaScript
function f() {
console.log('f');
}
function debounce(fn, delay) {
var timer = null;
return function () {
var context = this, args = arguments;
clearTimeout(timer);
timer = setTimeout(function () {
fn.apply(context, args);
}, delay);
};
}
$('input').keyup( function() {
console.log('k');
debounce(f, 100);
});