JSFiddle - React, Tailwind, and code Playground

HTML

<div id='timer'></div>

JavaScript

var second = 10;
var timeOutFunction;
document.getElementById('timer').innerHTML = second;
function setTimer()
{
    second--;
    document.getElementById('timer').innerHTML = second;
    if(second == 0)
        clearInterval(timeOutFunction);
}
timeOutFunction = setInterval(setTimer, 1000); //Timer for user display