JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<body>
<div id="timer"></div>
</body>
JavaScript
$(function(){
timer();
});
function timer(){
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
$("#timer").text(h + ":" + m + ":" + s);
var t = setTimeout(timer, 1000);
}
function checkTime(i) {
if (i < 10){
i = "0" + i;
}
return i;
}