JSFiddle - React, Tailwind, and code Playground

HTML

<img src="" id="images"/>

CSS

img{
    cursor:pointer;
}

JavaScript

var currentImageIndex = 0;
var images=[
    'http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1124750273-15.jpg',
    'http://d13s5ta1qg2cax.cloudfront.net/wp-content/uploads/rocky-movie.jpg'
    'http://images7.alphacoders.com/408/thumbbig-408758.jpg',
    'http://images6.alphacoders.com/410/thumbbig-410020.jpg',
    'http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1127034390-11.jpg'
];

document.getElementById('images').setAttribute('src',images[0]);
document.getElementById('images').onclick = function(){
    if(currentImageIndex<images.length-1)
        currentImageIndex++;
    else
        currentImageIndex = 0;
     document.getElementById('images').setAttribute('src',images[currentImageIndex]);
}