JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test" onClick="javascript:change()">qwerty</div>
CSS
#test {color: blue;}
#test.active {color:red;}
#test:hover {color:green;}
JavaScript
function change() {
document.getElementById("test").className='active';
}