next.js
2a93345f - [Docs] fix example function param and signature (#51235)

Commit
2 years ago
[Docs] fix example function param and signature (#51235) Apparently the object deconstruction in the example doesn't work. This PR proposes a working version: ```diff - export default function Page({ params: { slug: string } }) { - return <div>My Post: {slug}</div> - } + export default function Page({ params }: { params: { slug: string } }) { + return <div>My Post: {params.slug}</div> + } ``` According to the [page reference](https://nextjs.org/docs/app/api-reference/file-conventions/page), the page function parameter slugs needs to be retrieved by calling `params.slug`. The TypeScript section below shows the correct function type signature, although not referencing to the parameter.
Author
Parents
Loading