Unverified Commit 213a4b80 authored by Balázs Orbán's avatar Balázs Orbán Committed by GitHub

Fix getStaticPaths example code (#10893)

* Fix getStaticPaths example code

* Update docs/basic-features/data-fetching.md
Co-authored-by: 's avatarTim Neutkens <tim@timneutkens.nl>
parent 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% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment