Unpacking the New Features of Next.js 14: A Comprehensive Guide
Posted on Oct 30
Next.js 14 has arrived, bringing with it a host of new features and improvements that are sure to excite developers and enhance the overall development experience. In this article, we will delve into the release notes and explore what's new in Next.js 14, following the style and content of the video by Tuomo Kankaanpää titled "Next.js 14 - All you need to know" (link to video).
Local Development Performance Improvements
The first notable improvement in Next.js 14 is the enhancements made to local development performance, specifically with pages and the app router. With the integration of Turbo Pack, developers can now enjoy faster and more reliable performance when using the Next Dev. Currently, 5,000 integration tests for Next Dev are passing with Turbo Pack, covering approximately 90% of all tests. The goal is to achieve 100% test coverage and subsequently move Turbo Pack to stable in upcoming releases. It's worth noting that Webpack will continue to be supported for configurations and ecosystem plugins.
Server Actions
Server Actions, introduced in an earlier version of Next.js, are now stable. This feature allows developers to utilize backend features without the need for API routes or route handlers for each endpoint. Instead, server code can be defined directly within a component using the useServer
directive. This is particularly exciting for those using TypeScript, as it provides full end-to-end type safety between the client and server.
Partial Prerendering
Partial Prerendering is currently in preview and aims to simplify the plethora of runtimes, configuration options, and rendering methods available to developers. This feature does not require learning any new APIs and is built on React Suspense. It works by generating a static shell based on suspend boundaries and prerendering the fallback from React Suspense boundaries. The suspend fallbacks are then replaced with dynamic components once the data is ready. This approach ensures that a static HTML shell is immediately served upon request, with dynamic components being replaced as their content becomes available.
Metadata Improvements
With Next.js 14, blocking and non-blocking metadata have been decoupled. This ensures that non-blocking metadata will not prevent the partially pre-rendered page from serving the static shell immediately. Additionally, the viewport color, seam, and theme color options have been deprecated and replaced with new options, namely viewport and generate viewport.
Free Next.js Course
Next.js 14 also introduces a brand new free course on Next.js Learn, which can be accessed here. The course is comprehensive and covers everything you need to know to build a fully functioning Next.js application and deploy it to production.
Conclusion
Next.js 14 brings a host of improvements and new features that enhance the development experience and provide developers with more tools and options to build robust applications. The stability of Server Actions, the introduction of Partial Prerendering, and the free Next.js course are particularly noteworthy. As always, the team at Vercel has put a significant effort into documentation and education, ensuring that developers have all the resources they need to succeed.
Reference:
- Video: "Next.js 14 - All you need to know" by Tuomo Kankaanpää, link to video.
- Release notes: Next.js 14 release notes.