JSFiddle - React, Tailwind, and code Playground

HTML

<div class="counter"></div>

CSS

div.counter {
 background:gray;
    width:100px;
    height:20px;
    
}

JavaScript

$(document).ready(function(){
    var counterNum = 0;
    
    function tick()
    {        
        addText(counterNum);
        setTimeout('tick()',1000);
        counterNum++;
    }
    
    function addText(strNum)
    {
     $("div.counter").empty();
     $("div.counter").append(strNum);   
        
    }
});