I'm trying to send back a product values with onClick like this:
cart.js:
<RemoveButton
type="submit"
onClick={() => deleteItem(product.title, product.quantity, product.price)}
>
Remove
</RemoveButton>
Here is my reducer.js:
case DELETE_SOME_ITEM:
let items = state.products.filter(itemDelete => itemDelete.title === action.payload);
console.log(action.payload);
return {
...state,
products: items,
cartCost: state.cartCost - items.price,
basketNumbers: state.basketNumbers - items.quantity,
};
When I do console.log(action.payload) it just console product.title but not product.quantity and price
Here is my github project if you want to look over it: