JSFiddle - React, Tailwind, and code Playground
HTML
<div>0</div>
JavaScript
var x = document.querySelector('div');
x.addEventListener("click", onFocus, true);
function onFocus() {
if (x.style.background == '') {
x.style.background = 'red';
} else {
x.style.background = '';
}
}