Skip to content

Commit

Permalink
Update pages.md (#23064)
Browse files Browse the repository at this point in the history
The `path` variable must be an array of objects which has a `params` key. This code will prevent reader confusion.
  • Loading branch information
alex-safian committed Mar 15, 2021
1 parent 9afcdfc commit 3063d3b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/basic-features/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ export async function getStaticPaths() {
const posts = await res.json()

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

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

0 comments on commit 3063d3b

Please sign in to comment.