CodePark/ questions / App Router & files
START PRACTICINGPRACTICE
Frontend question · Next.js › App Router & files

In Next.js 15, how should this Server Component page read the slug param?

export default async function Page({
  params,
}: {
  params: Promise<{ slug: string }>;
}) {
  // read slug here
}
const { slug } = await params;

const { slug } = await params; is correct. Since Next.js 15, params and searchParams are Promises. Server Components await them, and Client Components can unwrap them with React's use(). The tempting const { slug } = params; is wrong because params is no longer a plain object. useParams() is a hook, and hooks cannot run in a Server Component. router.query is a Pages Router API.