I am mapping a list of data, within this list is some input fields. Usually I would use the useState hook to manage the data for the input field, but in this situation the number of input will be determined by data coming from an api, meaning there could be two input fields or ten.
My question is how can I dynamically handle the state per input field?
Here's an example:
{
data.map((item, i) => {
<div key={i}>
// There could be 2 inputs or 10 input fiels
<span>Input Number</span>
<input value="" onChange={() => updateStatefunction()} />
</div>;
});
}