JSFiddle - React, Tailwind, and code Playground

HTML

<div style="background-color: lightblue;height: 50px">Div de testes</div>
<script>
    var div = document.querySelector('div');
    div.style.backgroundColor = 'blue';
    var cor1 = div.style.backgroundColor;
    alert(cor1);
    window.onload = function() {
        var cor2 = div.style.backgroundColor;
        alert(cor2);
    }
</script>