JSFiddle - React, Tailwind, and code Playground
HTML
<p>
Time remaining: <span id="time"></span>
</p>
<button onclick="countDown()">start</button>
JavaScript
var time = 60;
function countDown() {
document.getElementById("time").innerHTML = time;
if (time >= 0) {
window.setTimeout("countDown()", 1000);
} else {
document.getElementById("time").innerHTML = "stopped";
}
time -= 1;
}