Movatterモバイル変換


[0]ホーム

URL:


Skip to content
Important
Security Advisory: React2Shell & two new vulnerabilities
Find out more

connection

Last updated October 22, 2025

Theconnection() function allows you to indicate rendering should wait for an incoming user request before continuing.

It's useful when a component doesn't useDynamic APIs, but you want it to be dynamically rendered at runtime and not statically rendered at build time. This usually occurs when you access external information that you intentionally want to change the result of a render, such asMath.random() ornew Date().

app/page.tsx
import { connection }from'next/server'exportdefaultasyncfunctionPage() {awaitconnection()// Everything below will be excluded from prerenderingconstrand=Math.random()return <span>{rand}</span>}

Reference

Type

functionconnection():Promise<void>

Parameters

  • The function does not accept any parameters.

Returns

  • The function returns avoid Promise. It is not meant to be consumed.

Good to know

  • connection replacesunstable_noStore to better align with the future of Next.js.
  • The function is only necessary when dynamic rendering is required and common Dynamic APIs are not used.

Version History

VersionChanges
v15.0.0connection stabilized.
v15.0.0-RCconnection introduced.

Was this helpful?

supported.

[8]ページ先頭

©2009-2025 Movatter.jp