JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" id="add">Add Field</button>
JavaScript
$("#add").click(function(){
var name = 'textbox[*]'.replace('*', $('.newRow').length + 1);
$('<input>')
.attr({'type':'text', 'name': name})
.val('new')
.addClass('newRow')
.insertBefore("button#add")
.after('<input type="button" class="remove" value="Remove"><br/>');
});
$(document).on("click",".remove",function(){
$(this).prev().remove()
$(this).next().remove()
$(this).remove()
})