Dynamic Fields in a Form added by user

Does anyone know how can I make a form where input fields can be used by the user?
For example, at first, I want only one pair of fields to be displayed with a button „Add Product“
Product 1 code:
Product 1 name:
Add another product

Then, if the Add Product is clicked, the form becomes:
Product 1 code:
Product 1 name:
Product 2 code:
Product 2 name:
Add another product

Is there a plugin or a block code that does this? Thank you!