JSFiddle - React, Tailwind, and code Playground
HTML
<div class="one"></div>
CSS
.one {
background:red;
width:300px;
height:200px;
}
.light {
background:#999;
width:300px;
height:200px;
}
.dark {
background:#000;
width:300px;
height:200px;
}
JavaScript
$(document).ready(function () {
var myClasses = ["light", "light", "dark", "light"];
var count = 0;
setInterval(function () {
$(".one").removeClass("light dark").addClass(myClasses[count]);
count >= 3 ? count = 0 : count += 1;
}, 1000);
});