I'm implementing a shopping cart, that obviously will have a button to add more products. I implemented the cart context and the functionality works fine, but when I increase the number of the products to purchase it doesn't change the number displayed. What could my issue would be?
Here is my code for the context consumer
render() {
return (
<CartContext.Consumer>
{
(cartContext =>{
const {addProduct} = cartContext
return(
<div>
<h1 key={this.props.product.itemId}> {this.state.product.name} </h1>
<button onClick={() => {addProduct(this.props.product.itemId)}}> Add </button>
<h4>{this.props.product.qty}</h4>
<hr/>
</div>
)
})
}
</CartContext.Consumer>
)
}