JSFiddle - React, Tailwind, and code Playground
HTML
<table id="mainTable">
<tr> <td>ITEM</td><td>ITEM</td><td>ITEM</td><td>ITEM</td>
</tr>
<tr> <td>ITEM</td>
</tr>
</table>
JavaScript
var CELLS_PER_ROW = 1;
var table = $('#mainTable')
var cells = table.find('td').remove(); //Grab the cells out of the table
table.html(''); //Get rid of any tr tags left behind
while(cells.length)
table.append($('<tr>').html(cells.splice(0, CELLS_PER_ROW)));