JSFiddle - React, Tailwind, and code Playground

by taheri

HTML

<a href="#" id="user_button">toggle</a>
<div class="hello"></div>

CSS

.hello{
    height:100px;
    width:100px;
  
    background-color:#000;
}
.active{
    background-color:#C00;
}

JavaScript

$('#user_button').toggle(function () {
        $(".hello").addClass("active");
    }, function () {
        $(".hello").removeClass("active");
    });