I have a list of inputs that are generated based on the number of items in an array:
const itemInputs = items.map(
item => <Input key={item} value={itemInput} onChange={event => this.updateItem(event)} />,
);
Here is what my updateItem function looks like:
updateItem(event) {
this.setState({
itemInput: event.target.value,
});
}
So if there are two items in my array, then two input fields will be generated, like so:

But when I enter a value for the first input field, that same value appears in the second input field, like so:
How can I prevent this from happening? I want each input field to retain its own value.
