Mike
Mike

Reputation: 63

NextJS - getStaticPaths check for new pages

I use getStaticPaths to prerender all dynamic pages. I was wondering how can I fetch all pages every x seconds?

enter image description here

Upvotes: 1

Views: 2204

Answers (1)

Shyam
Shyam

Reputation: 1454

@mike getStaticPaths pre-renders all the paths only at build time. You can use fallback prop to have fallback option while page is building. Refer this when is fallback useful

getStaticPaths and getStaticProps is all about pre rendering pages and using static pages. If you want to have always upto date content then use getServerSideProps instead.

In addition, in your code I see you are already using revalidate prop in getStaticProps which helps you to revalidate them every 60 seconds, I believe should serve your purpose.

Upvotes: 1

Related Questions