DEV Community

A.S.M. Habibullah Sadique
A.S.M. Habibullah Sadique

Posted on

Next.js features I'm excited about

Stable Incremental Static Regeneration

Simply speaking, this feature allows you to generate static content dynamically. Let's see a quick example:

Say you have a blog website with a lot of articles. When somebody visits /news/link, you want to serve them the static page as fast as you can.

But it is possible that you don't want to create all static pages at build time because it would take you a lot of time. In a few cases, this isn't possible at all at build time.

Also, sometimes your content might change, like a quick blog edit - so you don't really want a completely static page forever either. So what's the solution?

Using Next.js 9.5+, now you can generate static pages dynamically to the dynamic path and refresh them.

This means that once Next fetches that particular URL, it'll save it as a static page and serve it statically whenever somebody visits the path. At the same time, it'll be open to accepting new paths dynamically.

Not only can you do this, with a revalidate parameter, you can also actually specify that Next.js should update your static pages once every X seconds in the background if there's any change!

getServerSideProps

getServerSideProps, as the name suggests, allows you to inject props in your Next.js page from the server itself. And getStaticProps allows Next.js to still create static outputs at build time.

getStaticProps combined with incremental static regeneration is a killer feature in my opinion. You get the many benefits of a dynamic backend without having a dynamic backend.

Persistent Caching for Page Bundles

Next.js also supports persistent caches for pages that are not changed. Before, when you shipped a new Next.js app, Next.js would throw out the whole app and the user had to download all the CSS/JS again, even if those bundles were unchanged.

In the latest version of Next.js released last week, Vercel introduced persistent caching which is again an absolutely great thing to have performance-wise.

Top comments (1)

Collapse
 
sushantagupta007 profile image
Sushanta Gupta

Rich content.