Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix static params as promise examples #72553

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ export function generateStaticParams() {
// - /product/1
// - /product/2
// - /product/3
export default async function Page({ params }: { params: { id: string } }) {
export default async function Page({
params,
}: {
params: Promise<{ id: string }>
}) {
const { id } = await params
// ...
}
Expand Down Expand Up @@ -106,7 +110,7 @@ export function generateStaticParams() {
export default async function Page({
params,
}: {
params: { category: string; product: string }
params: Promise<{ category: string; product: string }>
}) {
const { category, product } = await params
// ...
Expand Down Expand Up @@ -145,7 +149,11 @@ export function generateStaticParams() {
// - /product/a/1
// - /product/b/2
// - /product/c/3
export default async function Page({ params }: { params: { slug: string[] } }) {
export default async function Page({
params,
}: {
params: Promise<{ slug: string[] }>
}) {
const { slug } = await params
// ...
}
Expand Down Expand Up @@ -263,7 +271,7 @@ export async function generateStaticParams() {
export default function Page({
params,
}: {
params: { category: string; product: string }
params: Promise<{ category: string; product: string }>
}) {
// ...
}
Expand Down Expand Up @@ -299,7 +307,11 @@ export async function generateStaticParams() {
}))
}

export default function Layout({ params }: { params: { category: string } }) {
export default function Layout({
params,
}: {
params: Promise<{ category: string }>
}) {
// ...
}
```
Expand Down
Loading