未验证 提交 3063d3b8 编写于 作者: A Alex Safian 提交者: GitHub

Update pages.md (#23064)

The `path` variable must be an array of objects which has a `params` key. This code will prevent reader confusion.
上级 9afcdfcb
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册