JSFiddle - React, Tailwind, and code Playground
HTML
<div id="box">
CSS
#box{width:20px;height:20px;background:blue;}
JavaScript
$(function(){
setInterval(function(){$("div#box").hide();},2001);
setInterval(function(){$("div#box").show();},1000);
});
$("div#box").on("DOMAttrModified",function(){if($(this).is(":visible"))console.log("visible");});