未验证 提交 213a4b80 编写于 作者: B Balázs Orbán 提交者: GitHub

Fix getStaticPaths example code (#10893)

* Fix getStaticPaths example code

* Update docs/basic-features/data-fetching.md
Co-authored-by: NTim Neutkens <tim@timneutkens.nl>
上级 2abbb7ab
......@@ -191,7 +191,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.
先完成此消息的编辑!
想要评论请 注册