'How to dynamically generate multiple forms based on counter variable in react?

I have a button that add a number to counter array, and based on counter, I want to generate a form over and over again. But I have a object state and whenever I click the button and generate a new form, the previous values of previous states that I answered, are there and I can't generate some new states, I really don't know what to do.



Solution 1:[1]

You could make your "form" into a React component, and have it manage its own state. Then, when you make a new form component, it will start at the default state.

It is difficult to understand what you are trying to do from your question. If may help if you update your question with a snippet of code showing what you have tried.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dave