JSFiddle - React, Tailwind, and code Playground

HTML

<div id="divRandom">
    &nbsp;
</div>

CSS

#divRandom {
    border: 1px solid #000;
}

JavaScript

var arrCores = ['#f00', '#0f0', '#0ff'];

setInterval(function(){
    document.getElementById('divRandom').style.backgroundColor = arrCores[Math.round(Math.random()*3)]}, 500);