JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tbody>
        <tr id='0'>
            <td>Row 1</td>
        </tr>
        <tr id='1'>
            <td>Row 2</td>
        </tr>
        <tr id='2'>
            <td>Row 3</td>
        </tr>
        <tr id='3'>
            <td>Row 4</td>
        </tr>
        <tr id='4'>
            <td>Row 5</td>
        </tr>
        <tr id='5'>
            <td>Row 6</td>
        </tr>
    </tbody>
</table>

JavaScript

$("tr").click(function () {
    var id = this.id;
    $(this).nextAll("tr").prop("id", function () {
        return id++;
    });
    $(this).remove();

});