11 - Creating a shopping cart list
All right, so now that we've used route parameters in order to have our product detail page display the correct product and you know, customize the content of that page, the next thing that we're going to do is something very similar to what we did with the products list, and we're going to create a shopping cart list for our shopping cart page. So let's open up the cart page, as we called it, and really all that we need to do here is display another list with the products that are in the user's cart. Now, the interesting thing here is the user doesn't yet have a shopping cart that we can work with, so what we're going to do is we're just going to use a simple React State Hook, and we're just going to sort of populate that with a few IDs of the products that we want to be in the user's cart. So let's just do that first. What we're going to do is we're going to say import useState from react, right? We can use this inside Next.js, just like we can with React. So we'll say…
Видео 11 - Creating a shopping cart list автора LMS
Видео 11 - Creating a shopping cart list автора LMS
Информация
12 января 2025 г. 4:29:43
00:08:42
Похожие видео