JSFiddle - React, Tailwind, and code Playground
HTML
Remaining <span id="placetoshowtime"></span>
<script>
function timer()
{
count=count-1;
if (count <= 0)
{
alert('he download has starte');
clearInterval(counter);
return;
}
document.getElementById("placetoshowtime").innerHTML = count; //display the time to user
}
var count=30; //30 seconds
var counter = setInterval('timer()',1000); //1000 will run it every 1 second
</script>