JSFiddle - React, Tailwind, and code Playground
HTML
<div id='css-slideshow'>
<figure>
<img/>
</figure>
</div>
JavaScript
var imgURLS = ['Oculus.jpg', 'future-vr.jpg', 'morpheus.jpg', 'samsungvr.jpg'];
var image = document.querySelector('#css-slideshow img');
function carousel() {
var timer, count = 0;
var loop = function loop(count) {
if (count === imgURLS.length) count = 0;
// in your code this would be image.src
image.textContent = imgURLS[count];
timer = setTimeout(loop, 2000, ++count);
}
loop(count);
}
carousel();