Cannot read properties of undefined (reading 'quantity')
In the Showproduct
component you need to get index
from props
, not as an independent argument. Currently, index
is undefined
so getting product_list[index]
results in undefined
, which is why you see that error.
Just remove index
as an independent argument in Showproduct
and update the button's onClick
from props.incqty(index);
to props.incqty(props.index);
.