The Next js 12.1 is here and this is a big deal as it launches one of the most important releases, a singular important feature that is on-demand that is in beta now. It is an unstable mode but it’s still available and works. All of these updates are crazy.
Details about Next js latest update
Now before actually discussing what exactly this does on a technical level let’s understand something known as incremental static regeneration with a revalidate parameter. Earlier what it used to do is that it will give you an option that allows you to periodically regenerate a static page, for example, if you want to generate a page it takes 30 seconds and maybe in 60 seconds to actually render something meaningful but now with this on-demand incremental static regeneration you can programmatically regenerate stuff.
The way they do this is to use a webhook for those events on one of their API functions and once that webhook hits the Next js, it runs this code on their end. It is an API endpoint and an unstable validator, it is just a way to revalidate a particular path and that’s it, you just specify the path you want to revalidate and it’s just gonna push the cache and this is amazing because you now have the power to invalidate cache for a single page or a path in a single command on their global CDN within 300 milliseconds which is a crazy low amount.
It is a game-changer for developers, as it allows you to build highly dynamic websites with highly cached versions so you might have a dynamic route where you can have one page which is accessed a lot whereas the other page which is not accessed at all that much and you can keep both of those pages.
Webhook makes Next js a framework and also has such proprietary power because this is not something you will get on AWS or Netlify.
Below are the updates made in the latest version.
- Rust Compiler
- Middleware (beta)
- Bot-aware ISR Fallback
- React 18 Support
- Native ES Modules Support
- URL Imports (alpha)
That’s pretty much it for this article.