From the course: Next.js: Creating and Hosting a Full-Stack Site

Unlock this course with a free trial

Join today to access over 24,800 courses taught by industry experts.

Using route parameters in route handlers

Using route parameters in route handlers - React.js Tutorial

From the course: Next.js: Creating and Hosting a Full-Stack Site

Using route parameters in route handlers

- [Instructor] Well, now that we've created our first useful route handler for our e-commerce application, let's continue on, and we're actually going to take a look at a concept here that will make it much easier to load individual product data, which we're going to need to do on our product detail page. So what we're going to do here is, you may remember that when we created our product detail pages, which we can take a look at here just by going to slash products/123, we were able to refer to a specific product using the product's ID, and because of this, we were able to reuse the same page for multiple products, right? So we were able to say products/123 and see one product on that page, and then we were able to change this to like 345 and see a completely different product on that page. So the thing is that it would be really nice if we were able to do this same thing with route handlers, because that would allow us to load data for individual products instead of many products at…

Contents