HTML / CSS

Next.js 15 Release Candidate: New Features and Enhancements

Next.js 15 RC shipped with a few changes that actually matter for how I build apps. Here's what stood out.

26 May 2024

Next.js 15 Release Candidate: New Features and Enhancements

Next.js 15 RC shipped with a few changes that actually matter for how I build apps. Here's what stood out.

React 19 support and the React Compiler

Next.js 15 adds first-class support for React 19. The big deal here is the experimental React Compiler. It analyzes your components at build time and automatically optimizes re-renders. In theory, you stop writing useMemo and useCallback everywhere.

To enable it:

Text
npm install babel-plugin-react-compiler

Then in your next.config.ts:

Text
const nextConfig = {
  experimental: {
    reactCompiler: true,
    compilationMode: 'annotation',
  },
}

The annotation mode lets you opt components in selectively with a "use memo" directive, rather than applying the compiler to everything at once. I'd start there. The compiler is still experimental and can produce surprising results with complex state patterns.

Caching changes

This is the breaking change that caught my attention. Next.js 15 no longer caches fetch requests and route handlers by default. In previous versions, everything was cached aggressively unless you opted out. Now you have to opt in.

This is a good change. I've seen too many bugs caused by stale cached data in production where developers didn't realize a route handler was cached. Explicit caching is safer.

Partial Prerendering (experimental)

Partial Prerendering lets you combine static and dynamic content in a single route. The static shell renders instantly, then dynamic parts stream in. Think of it as static site generation and server-side rendering coexisting in the same page.

You wrap dynamic sections in <Suspense> boundaries. The static parts prerender at build time. The dynamic parts render on the server at request time and stream to the client.

This is powerful for pages that are mostly static but have a few personalized sections (like a logged-in user's name or a cart count).

The trade-offs

The caching default change will break existing apps on upgrade. If you relied on implicit caching, you'll need to add explicit cache headers to maintain the same behavior. The React Compiler is still early -- I wouldn't ship it to production without thorough testing. And Partial Prerendering adds mental overhead: you now need to think about which parts of your page are static vs dynamic at the component level.

Still, this release moves Next.js in the right direction. Less magic, more control.