JSFiddle - React, Tailwind, and code Playground
HTML
<div>0</div>
JavaScript
function countTo(max, n){
var n = n || 1;
setTimeout(function(){
$('div').html(n);
if(n < max) countTo(max, n + 1);
}, 1000);
}
countTo(5);