JSFiddle - React, Tailwind, and code Playground
HTML
<div class="showhide"></div>
CSS
.showhide {
width:100px;
height:100px;
background:#484848;
}
.showhidenew {
width:100px;
height:100px;
background:#FF0000;
}
JavaScript
$(".showhide").toggle(function(){
$(this).attr("class", "showhidenew");
},function(){
$(this).attr("class", "showhide");
});