JSFiddle - React, Tailwind, and code Playground
HTML
<button>Button</button>
CSS
.bye-bye {
background-color: #333;
}
button {
color: #fff;
transition: all 1s ease;
}
JavaScript
var button = document.querySelector('button');
button.addEventListener('mouseover', function() {
button.classList.add('bye-bye');
});
button.addEventListener('transitionend', function(e) {
console.log(e);
button.parentNode.removeChild(button);
});