JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" value=" Click to count! " />
<div></div>

JavaScript

(function() {
    var myArray = [
        'apple',
        'banana',
        'orange'
    ], fruitCount = 0;
    $(function() {
        $("input").click(function() {
            $("div").html(myArray[fruitCount++ % myArray.length]);
        });
    }); 
}());