Set up Individual Product Pages with Next.js Dynamic Routes

InstructorColby Fayock

Share this video with your friends

Send Tweet

We are going to take a query and use it to create a dynamic query out of it with variables. In doing that, we are going to make use of the getStaticPaths function to create a path for every single one of our products.

Then, we'll use getStaticProps to query for each and every one of those dynamically using the variables object, where just like any other page, we will grab that data as a prop to our product page function, where we will fill in our page and have our dynamic route.

Jason
~ 2 years ago

My slug doen't show up in the where clause only the id. I've checked and it is setup the same way as you did and is set as unique. Weird because there isn't anything in the docs to help.

Jason
~ 2 years ago

I was able to make it work with the id field and still love this course.