JSFiddle - React, Tailwind, and code Playground
HTML
<img src="http://lorempixel.com/100/100/">
CSS
img {
padding: 100px;
transition: 300ms;
}
JavaScript
$("img").click(function() {
if ($(this).css("transform") === "none") {
$(this).css("transform", "rotate(180deg)")
} else {
$(this).css("transform", "rotate(" + (parseInt(this.style.cssText.match(/\((\d+)deg\)/)[1]) + 180) + "deg)")
}
})