Do I need to use revalidate key in getStaticProps Next.JS for lists in page?

753 views Asked by At

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!

1

There are 1 answers

0
Mehdi Faraji On

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

export const getStaticProps = () => {
  return {
     props : {
      // data  
     } , 
     revalidate : 1
  }
}