JSFiddle - React, Tailwind, and code Playground

HTML

<table id="tb1" cellspacing="0">
    <tr>
        <td id="td1">make table red</td>
        <td id="td2">make table yellow</td>
    </tr>
</table>

CSS

table {
    border: none;
    border-collapse: collapse;
    }

table.type-01 {background-color: red;}
table.type-02 {background-color: yellow;}

td {
    border: 1px solid black;
    padding: 5px;
    }

JavaScript

$('#td1').hover(function () {
    $('#tb1').toggleClass('type-01');
});

$('#td2').hover(function () {
    $('#tb1').toggleClass('type-02');
});