JSFiddle - React, Tailwind, and code Playground
HTML
<div id="mydiv"></div>
CSS
div {
height:100px;
width:100px;
background-color:blue;
}
.hovered {
background-color:red;
}
JavaScript
var hoverTimeout;
$('#mydiv').hover(function() {
$(this).addClass('hovered');
}, function() {
var $self = $(this);
hoverTimeout = setTimeout(function() {
$self.removeClass('hovered');
}, 1000); //set time
});