I want to uncheck the checkbox, when props changes.
How can I do this ?
This is my code:
<input type="checkbox" value={inventory.id}
defaultChecked={_.some(this.props.cart.data, (cart) => {
return cart.id === inventory.id
})}
onClick={(e) => this.addToCart(e, inventory)}/>
When I remove data from this.props.cart, checkbox should be unchecked.
Thank you