Next.js Demo Website

Next.js Demo Website

Hello Mr Miloje Stojaković

A profile picture of some guy


From the LogRocket blog:
Incremental Static Regeneration (ISR) is a newly released feature that allows the regeneration of static pages during runtime. It’s a hybrid solution of SSG and SSR.
This page uses incremental static regeneration. getStaticProps(). That means that during build time, it retireves the data from the Random User API and generates the html with the text and images.

Everybody who visits this site within 10 seconds will see the same name and image of the person when we fetched the data at build time. When a new request comes in after 10 seconds, Next.js will regenarate the HTML in the background and you will see a new user.

Note: This will not work in a dev enviornment. If you run this in a dev enviornment, then getStaticProps() will get called on every request and every time you navigate to this page, a new user is fetched.

Examples of Rendering Strageties

Other Resources on Incremental Static Regeneration

https://arunoda.me/blog/what-is-nextjs-issg


Source Code