JSFiddle - React, Tailwind, and code Playground
JavaScript
var timeout = null;
$(document).on('mousemove', function() {
if (timeout !== null) {
$(document.body).text('');
clearTimeout(timeout);
}
timeout = setTimeout(function() {
$(document.body).text('Mouse idle for 3 sec');
}, 3000);
});