My Code Snippet is below:
<TextInput
type="number"
id="qty"
defaultValue={qty}
onChange={checkValue}
useRef={qty}
/>
const checkValue= (err) => {
err.preventDefault();
setState({[Id]:Number(err.currentTarget.value)});
};
<Button
type="submit"
onClick={onSubmit}
>
Update
</Button>
const onSubmit = err => {
err.preventDefault();
const items = Items.map(p =>({
id:p.id
quantity:state[p.id]?state[p.id]:p.qty
}));
list.updateList(items,id);
};
I have to update the multiple Products Quantity,but with the above code able to to change only one of the product,if the change both the products quantity only 2nd product quantity is getting changed,how to change both the products quantity.if i give only p.qty then even if i change only one product ,both the products updated with same value.Please help on this