JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" id="newRowButton">Add</a>

<table>
 <tr>
  <td><input type="text" name="FirstName1" /></td>
  <td><input type="text" name="LastName1" /></td>
 </tr>
 <tr>
  <td><input type="text" name="FirstName2" /></td>
  <td><input type="text" name="LastName2" /></td>
 </tr>
</table>

JavaScript

$("#newRowButton").click(function() {
      $("table tr:last")
          .clone()
          .appendTo("table")
          .find(':input')
          .attr('name', function(index, name) {
              return name.replace(/(\d+)$/, function(fullMatch, n) {
                  return Number(n) + 1;
              });
          })
    });