JSFiddle - React, Tailwind, and code Playground
by Grief
HTML
<div id=outter>
<div id=test></div>
</div>
CSS
#test {
position: fixed;
left: 2em;
right: 2em;
top: 2em;
bottom: 2em;
background-color:red;
transition-duration: 2s
}
JavaScript
var outter = document.getElementById('outter');
var test = document.getElementById('test');
test.onclick = function() {
outter.removeChild(test);
test.style.backgroundColor = 'green'
outter.appendChild(test);
setTimeout(function() {
test.style.backgroundColor = 'red'
}, 0);
}