Next.js

next/async-params

Await params and searchParams in App Router pages, layouts and generateMetadata; Next.js 16 removed synchronous access.

seriousstaticfe-nextjs

Why

Since Next.js 15 the params and searchParams props are promises; 15 still allowed reading them directly as a temporary bridge, and 16 removed it. Code such as params.slug now reads a property of a promise: it is undefined, the page renders the wrong item or a 404, and TypeScript only catches it when the props are typed as promises.

Fix

const { slug } = await params in an async Server Component (and in generateMetadata); in a Client Component page, const { slug } = use(params). Type the props with the generated helpers (PageProps<'/blog/[slug]'>, LayoutProps) from npx next typegen, or run the next-async-request-api codemod. generateImageMetadata and generateStaticParams keep synchronous values.

Examples

// bad
export default function Page({ params }) { return <Post slug={params.slug} /> }
// good
export default async function Page({ params }: PageProps<'/blog/[slug]'>) {
  const { slug } = await params
  return <Post slug={slug} />
}

Sources

Facts

Id
next/async-params
Severity
serious
Check
static checked in the source by audit
Applies to
jsx
Only in projects with
next
Taught by the skill
fe-nextjs Next.js App Router
Since version
0.1.0

Rule file on GitHub

Read it in the terminal

npx github:dawidolko/frontend-skills explain next/async-params