JSFiddle - React, Tailwind, and code Playground
HTML
<div class="tab">
<button onclick="changeColor(event)">Click Me</button>
</div>
CSS
.tab button {
background-color: yellow;
}
/* Create an active/current tablink class */
.tab button.active {
background-color: red;
}
JavaScript
function changeColor(evt){
evt.currentTarget.className += "active";
}