1

I'm making static e-commerce app with Next.JS.

I have products directory with index.js and [id].js files. Do I need to use revalidate: someTime in products/index.js file which returns list of all products for keeping list up to date? Or it's feature only for product individual pages ([id].js)?

Thanks in advance for you help!

andrewnosov
  • 374
  • 4
  • 14
  • 1
    If you want the list of products to be updated when adding a new product you'll want to use `revalidate` in `index.js`. – juliomalves Jan 23 '21 at 23:38

1 Answers1

0

You can use revalidate with getStaticProps data fetching method like this :

export const getStaticProps = () => {
  return {
     props : {
      // data  
     } , 
     revalidate : 1
  }
}
Mehdi Faraji
  • 2,574
  • 8
  • 28
  • 76