How can I add a new form using an add button and delete each form using a delete button?

  • Goal: How can I add a new form using an add button and delete each form using a delete button?

  • Steps:

  • Details:
    hi,
    Here, I am adding a form using the add button with the help of the {{ state3.value+1 }} variable, and removing the form using the remove button by decrementing the {{ state3.value-1 }} variable.

I want to delete a form using the delete button. Suppose there are 3 forms, and I want to delete the form at index 2 using the delete button. How can I do this? Please suggest a solution.

1 Like

Hello @react-work_dev,

In my opinion, the best way to go about it is to make the state3 variable be a list of values, that way you could easily access the index of the button click.