Next.js v15 aligns with the React 19 Release Candidate, bringing its new features and improvements to the framework. This includes:
useActionState
: Helps manage and display the state of ongoing server actions in the UI.useFormStatus
: Ideal for tracking form submission states in real-time, allowing for UI updates like disabling a button during submission.To provide more predictable behavior and better performance, Next.js v15 changes default caching behaviors:
fetch
and Route Handlers:fetch
Requests now default to a no-store
strategy. Explicit cache
parameters are required to enable caching.GET
Route Handlers are no longer cached by default. You can opt into caching using export dynamic = 'force-static'
. Special Route Handlers like sitemap.ts
, opengraph-image.tsx
, and icon.tsx
remain static by default unless they use dynamic functions.experimental.staleTimes
flag is still available for manual configuration of client-side caching.Several request-specific APIs are now asynchronous, which is a breaking change but allows for better performance by enabling components to be pre-rendered:
cookies()
headers()
draftMode()
params
(in layout.js
, page.js
, route.js
, etc.)searchParams
(in page.js
)Codemods are available to help automate the migration of existing synchronous usages.
<Form>
ComponentNext.js 15 introduces an enhanced <Form>
component that extends the traditional HTML <form>
element with:
Turbopack, Next.js's next-generation bundler, sees significant advancements:
next dev --turbo
): Provides blazing-fast local server startups and quicker code refreshes.next build --turbopack
): Now passes all integration tests, aiming for stable production use in future releases.Debugging has been significantly overhauled for a more intuitive and efficient experience:
A new visual indicator helps developers quickly identify which routes are static during the development process, providing insights into the application's structure.
unstable_after
APIThis experimental API allows developers to execute server tasks after a response has finished streaming to the user. This is useful for non-critical tasks like logging, analytics, or other system synchronization that shouldn't block the primary response.
Next.js 15 introduces support for ESLint 9 while maintaining backward compatibility with ESLint 8. This update, along with eslint-plugin-react-hooks
v5, further improves code quality.
next.config.ts
The next.config.js
file now supports TypeScript, allowing developers to create next.config.ts
files and benefit from TypeScript's type checking for configuration options.
onRequestError
HookInstrumentation is now stable with the introduction of the register()
API, allowing for performance monitoring, error tracking, and deep integration with observability libraries. A new onRequestError
A hook is also introduced, particularly in collaboration with Sentry.
revalidateTag
: Can now pass multiple tags at once.images.remotePatterns.search
and images.localPatterns
: New configuration keys for next/image
for better control over image compression restrictions.Cache-Control
header, which was previously rigidly overwritten.next/dynamic
Caching: Modules are now cached and reused, rather than being reloaded each time.These updates aim to make Next.js even more powerful, performant, and developer-friendly.
Thank you
sonjoybarman