JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test2" class="test" style="height:30px; width:150px; background-color:red; border:1px solid green;"></div>
<button id="test1">Test</button>
CSS
div.test{
border:2px solid black !important;
background-color:blue !important;
}
div.test2{
background-color:blue !important;
}
JavaScript
$('#test1').click(function(){
$("#test2").removeClass("test").addClass("test2")
});