JSFiddle - React, Tailwind, and code Playground

HTML

<div id="expander" class="closed">></div>

CSS

.closed {color:red;}
.open {color:blue;}

JavaScript

$("#expander").click(function(){
    $(this).toggleClass('open closed');
});