Category: Next.js, React and TypeScript

Next.js 15: reading params.slug without await generates an error

Read this guide in Polish

After the Next.js update, the dynamic route begins to report that the params should be read asynchronously. In the newer App Router params are transmitted as a Promise value in the respective page functions.

How to determine the source of the error

Check Next.js version and all params read places in page, layout and generateMetadata.

Compare the Props type with the actual framework function contract instead of adding any projection.

What to do step by step

1. Define params: Promise<{slug:string > and read const {slug}=await params in the proper asynchronous function.

2 . For many segments, correct all use sites; prepare a test to open a specific dynamic address.

How to check the score

Typecheck and build pass, and entering the address /guides/example opens the correct data without warning.

What to do

Do not copy signatures from the documentation of the older main version without checking the version of the project.