Next.js: Can I use generateStaticParams for a page with a dynamic component inside? i.e have a specific component fetch data & render everytime

I am currently using NextJS 13.5 to build an ecommerce.

In the app/products/[slug]/page.jsx I have product name, description, price and other product related information. I use the generateStaticParams() function in order to statically build each product page with next build.

Having said all that, the problem I am facing is that a product’s price cannot be static!
Products’ prices change frequently, sometimes even daily.

How could I have the price of every product to be dynamic and fetched from the database on each visit, even though the rest of the product page (name, description etc) is static, and basically SSG?

Any knowledge or ideas are appreciated! 🤗 🙏

Leave a Comment