JSFiddle - React, Tailwind, and code Playground
HTML
<p>You'll be automatically redirected in <span id="count">10</span> seconds...</p>
JavaScript
$(function(){
var counter = 10;
setInterval(function() {
counter--;
if (counter >= 0) {
span = document.getElementById("count");
span.innerHTML = counter;
}
// Display 'counter' wherever you want to display it.
if (counter === 0) {
// alert('this is where it happens');
alert(counter);
}
}, 1000);
});