score:1

Accepted answer

you could use the style prop on your grid and it should work fine.

const [isshown, setisshown] = react.usestate(false)
function changebackground(e) {
e.target.style.background = 'red';

 <grid
      onmouseenter={() => setisshown(true)}
      onmouseleave={() => setisshown(false)} 
      style={{ width: "120px", height: "120px", 
      backgroundcolor:isshown? "red" : ""  }} 
</grid>


Related Query

More Query from same tag