Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Consider this:
JavaScript
<>
<input type="text" placeholder={props.placeholder} className="optionsInput" />
<input type="text" placeholder={props.placeholder} className="optionsInput" />
</>;

I add the component above which is pair of inputs dynamically by a button.
The most important thing is these pairs are related to each other and I need to match them.
For example:
JavaScript
<>
First Input: First Name
Second Input: Last Name
</>


I want to save data by using `onChange` event but in a form like this:
JavaScript
const [data, setData] = useState([
  {First Input: First Name, Second Input: Last Name}
]);

But I don't know how to solve this.
*Note*: Consider that these inputs are added automatically and can be added to 100 times.
Every help will be appreciated.

What I have tried:

I don't have any idea how to solve the problem I have.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900