JSFiddle - React, Tailwind, and code Playground
HTML
<div class="test"></div>
CSS
.test {
width: 100px;
height: 100px;
background: green;
-webkit-transition: 1s;
transition: 1s;
}
.red {background: red;}
.blue {background: blue};
JavaScript
var animationDuration = 1000; // 1 second
$('.test').addClass('red');
setTimeout(function() {
$('.test').removeClass('red').addClass('blue');
}, animationDuration);