Codecademy strore help

hello all,
I have just completed all of the tasks for this challenge. After I completed it I noticed that there are a few things that I have a few questions on even after I watched the video and redid the exercise with the video.

  1. the currency feature is not working, everything looks good in the currencyFilter.js file but when it renders the selected currency is blank and never changes item prices or cart total when selecting different currency’s

  2. the quantity in the cart is not updating and I have no clue why again I went through it with the video and nothing I have tried has worked

Hello, and welcome to the forums!

The learning environment for this project can be a little misleading because it has the black box under the code editor where you’d think errors are reported, but it doesn’t report certain errors that are encountered at runtime. For this reason, it’s still important to check the browser’s console for error messages. At least one of the two issues you listed will have big clues in the browser’s console.

  1. The Currency Feature - Check that everything is consistent. Follow how the slice for this feature is initialized and passed to different components. This can be a more difficult one to spot because it may not result in any console errors. Some questions to ask yourself: What’s the name of the slice in the store? How is it referenced in other components? Is the reducer being used?
Click for another hint

In store.js, you’re using combineReducers({inventory:inventoryReducer,cart: cartReducer, currency:currencyFilterReducer }) to create a root reducer, which you then use to create the store.

So the slice name is currency since that’s the key you passed to combineReducers()

From index.js, the store is passed to the App component on the state prop. From App.js, you’re passing the slice to the CurrencyFilter, Inventory, and Cart components using currencyFilter={state.currencyFilter}

Click for another hint

That’s where the issue is. It isn’t named currencyFilter here because you called it currency when you created it.

You either need to change your call to combineReducers() in store.js to have the slice named currencyFilter, or you need to change App.js to pass currency instead using: currencyFilter={state.currency}

  1. This one you will be able to spot in the browser’s console. After you try to change the quantity directly from the cart, look closely at the error message. It won’t give you an exact line number you can easily use because the files are being compiled in the background, but you’ll be able to pinpoint the issue from the variable name mentioned.
Click for another hint

In cartSlice.js, you assign an object to updateditem but then you reference it using updatedItem


Thank you this was a big help.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.