JSFiddle - React, Tailwind, and code Playground

HTML

<span id="total">0</span>

JavaScript

var x = 0;
var int=self.setInterval(function(){count()},5000);

function count(){
  x++;
  document.getElementById("total").innerHTML=x;
}