JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr>
        <th>
            <input type="checkbox" id="selectAll" />
        </th>
        <th>
            hi!
        </th>
    </tr>
    <tr>
        <td>
            <input type="checkbox" id="1"/>
        </td>
        <td>
            hi!
        </td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" id="2"/>
        </td>
        <td>
            hi!
        </td>
    </tr>
</table>

JavaScript

$('#selectAll').click(function(e){
	var table= $(e.target).closest('table');
	$('td input:checkbox',table).attr('checked',e.target.checked);
});