i got array of objects that assigned in state and i want to modify a property with input field. I tried some below :
<input
key={item.ingName}
type="text"
className="form-control"
placeholder={item.ingName}
name="ingName"
value={item.ingName}
onChange={(e) => {
item.ingName = e.target.value
setIngredients([...ingredients])}}
/>
and array is like :
ingredients : [{ingName: "meat", quantity: "1", unit: "kilogram"},
{ingName: "pickles", quantity: "100", unit: "grams"}]
These one only adds first letter that i wrote in keyboard.I need to achieve that proper working input field.
ingNamefor both. That seems...odd. And if you're changing it, it shouldn't be thekey.