Skip to content
Advertisement

(React and Redux) Problem with adding items to the shopping cart

I am following a tutorial, where we are building a shopping cart, which is still unfinished, but I would like to solve this problem before continuing in the tutorial.

The thing is, that when I try to add any item to the cart, the cart is still saying me, that my shopping cart is empty. You can notice in the url of this picture below, that I have added the item with id number 1 to the shopping cart and quantity (qty) is also 1. enter image description here

But the shopping cart should not respond this kind of message after adding an item into it. At this stage, in which the code is, the response should be just a blank page.

This didn´t work yet when I was trying to console.log the cartItems – it was an empty array for me, but the instructor was receiving the data about the products, which were added to cart. So that might be a clue.

Please take a look at the following files and let me know, if You will be able to see any hint or a solution.

CartScreen.js –

JavaScript

cartActions.js –

JavaScript

cartReducers.js –

JavaScript

cartConstants.js –

JavaScript

store.js –

JavaScript

ProductScreen.js –

JavaScript

Advertisement

Answer

here is the error :

JavaScript

it should be “id” not div

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement