From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Cart component

Cart component

Hello and welcome back. In the last video, we set up our card slice and we were facing these two issues down there, which is saying that the total and the item has any type and we haven't defined any type for this. To fix this issue, we don't really need to define anything here. It's complaining because this slice is right now not plugged in with the reducer in our store. So we just have to plug this reducer and we should be good to go. So we can go to the store. The store is already defined to have this type. So we can define a cart to be of type cart reducer. And we can import this card-reducer from features slash card-slice. There you go. Once this is done, your card-slice is all ready to be usable. Now we have set up our card slice, our store, our product card component as well as our product list component too. We also have the API set up which is going to give us the results. Now we need to implement a few things. Inside our product card, we left this code for handling the card…

Contents