JSFiddle - React, Tailwind, and code Playground

HTML

<div id="myimage"></div>

<p id="demo">Click the light bulb to turn on/off the light</p>

<button id="date">Display Date</button>

CSS

#myimage {
    background: url(http://www.easyvectors.com/assets/images/vectors/afbig/lightbulb-on-off-clip-art.jpg);
    width: 197px;
    height: 318px;
}

JavaScript

var state = false;

document.getElementById('myimage').onclick = function () {
    this.style.backgroundPosition = (state = !state) ? '-228px 0px' : '0px 0px';
}

document.getElementById('date').onclick = function () {
    document.getElementById("demo").innerHTML = Date();
};