JSFiddle - React, Tailwind, and code Playground

HTML

<body class="class1">
    Target Elelemnt 
</body>

CSS

.class1 { background-color: red;}
.class2 { background-color: blue;}

JavaScript

$(document).ready(function () {
    setInterval(function() {
          $('body').toggleClass('class2');
    }, 5000); 
});