JSFiddle - React, Tailwind, and code Playground

HTML

<img id="smiley" data-rotation-angle="0" src="https://us.123rf.com/450wm/martialred/martialred1507/martialred150700956/42621683-stock-vector-happy-or-healthy-smiley-face-icon-for-apps-and-websites.jpg" />

JavaScript

$( function() {
    $( '#smiley' ).on( 'click', function( ev ) {
    		ev.preventDefault();
        var rotationAngle = parseInt( $( this ).data( 'rotation-angle' ) );
        rotationAngle += 90;
        if ( rotationAngle > 270 ) {
        		rotationAngle = 0;
        }
        $( this ).data( 'rotation-angle', rotationAngle );
        $( this ).css( 'transform', 'rotate(' + rotationAngle + 'deg)' );
        console.log( rotationAngle );
    } );
} );