JSFiddle - React, Tailwind, and code Playground

HTML

<table>
    <tr><td>1</td><td>test</td></tr>
    <tr><td>2</td><td>test2</td></tr>
    <tr><td>3</td><td>test3</td></tr>
</table>

JavaScript

$("tr").click(function() {
        var $table = $(this).closest('table');
        $(this).remove();
        $table.find('tr > td:first-child').map(function() {
            $(this).html($(this).parent()[0].rowIndex + 1);
        });
    });