JSFiddle - React, Tailwind, and code Playground

JavaScript

var start = Date.now();
var end = start + 5000;

function spinWheel() {
    start = Date.now();
    console.log("Hello");
    if(start > end) clearInterval(timer);
}
var timer = setInterval(spinWheel, 100);