JSFiddle - React, Tailwind, and code Playground
HTML
<div id="A"></div>
<div id="B"></div>
CSS
#A{
background-color:#C71114;
width: 100px;
height: 100px;
}
#B{
background-color:#09E41B;
width: 100px;
height: 100px;
transition: all 1s;
}
#B.C{
background-color:#1E88DF;
width: 100px;
height: 100px;
margin: 10px;
transition: all 1s;
}
JavaScript
var test = document.getElementById('A'),
test2 = document.getElementById('B');
test.onclick = function(){
test2.classList.toggle('C');
}