JSFiddle - React, Tailwind, and code Playground

HTML

<div id="a" onmouseover="chbg('red')" onmouseout="chbg('white')">This is element a</div>
<div id="b">This is element b</div>

JavaScript

function chbg(color) {
    document.getElementById('b').style.backgroundColor = color;
}