JSFiddle - React, Tailwind, and code Playground

HTML

<div class="test"></div>

JavaScript

var i = 0;

var timer = setInterval(function() {
    $('.test').html(i);
    
    i++;
    
    if(i > 10) {
        clearTimeout(timer);
    }
}, 100);