Skip to content

Commit 3063d3b

Browse files
authored
Update pages.md (#23064)
The `path` variable must be an array of objects which has a `params` key. This code will prevent reader confusion.
1 parent 9afcdfc commit 3063d3b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/basic-features/pages.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ export async function getStaticPaths() {
160160
const posts = await res.json()
161161

162162
// Get the paths we want to pre-render based on posts
163-
const paths = posts.map((post) => `/posts/${post.id}`)
163+
const paths = posts.map((post) => ({
164+
params: { id: post.id },
165+
}))
164166

165167
// We'll pre-render only these paths at build time.
166168
// { fallback: false } means other routes should 404.

0 commit comments

Comments
 (0)