JSFiddle - React, Tailwind, and code Playground

JavaScript

function pad(s) {
    return (s < 10) ? '0' + s : s;
}

function relogio() {
    var tempo = new Date();
    var hora = tempo.getHours();
    var min = tempo.getMinutes();
    var seg = tempo.getSeconds();

    var impressao = [hora, min, seg].map(pad).join(':');
    document.body.innerHTML = impressao;
}

setInterval(relogio, 1000);