Course lesson

Use Next.js Dynamic Routes to Create Product Pages for an Online Store

We'll create individual pages for each product using dynamic routes and statically generated pages. We'll do this by taking advantage of Next.js's ability to create dynamic routes and the use of getStaticPaths as well as the getStaticProps functions to create...

Duration
6 min
Access
Pro
Transcript
Available

We'll create individual pages for each product using dynamic routes and statically generated pages. We'll do this by taking advantage of Next.js's ability to create dynamic routes and the use of getStaticPaths as well as the getStaticProps functions to create a unique page for each product.

To start we'll update the product page to a dynamic route using the bracket notion in our filesystem ([param]).  Import products JSON document and create static paths using the getStaticPaths function. Proceed to configure static product props using path parameter with the getStaticProps function. And finally, use the global cart state to add products to the shopping cart.