JSFiddle - React, Tailwind, and code Playground

HTML

<div id="timer"></div>

JavaScript

var time = 0;

function startTimer() {
    // note: timer interval reduced for demo purposes
    window.setInterval(add, 1 *  1000);
}

function add() {
    time += 1;
    document.getElementById("timer").innerHTML = time;
}

startTimer();