JSFiddle - React, Tailwind, and code Playground
HTML
Enter Text To Search :-
<input stype="text" id="search" />
<br/>After 2 seconds search will be fired on :- <span id="textTobeSearched"></span>
JavaScript
var timer;
$('#search').keyup(function () {
clearTimeout(timer);
timer = setTimeout(function (event) {
console.log('Search keypress');
var text = $('#search').val();
$('#textTobeSearched').text(text);
}, 2000);
});