From 213a4b806740e5842b4b13a964acc951e31b915f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Orb=C3=A1n?= Date: Mon, 9 Mar 2020 10:24:15 +0100 Subject: [PATCH] Fix getStaticPaths example code (#10893) * Fix getStaticPaths example code * Update docs/basic-features/data-fetching.md Co-authored-by: Tim Neutkens --- docs/basic-features/data-fetching.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/basic-features/data-fetching.md b/docs/basic-features/data-fetching.md index 3dc2d1585c4db07..6185e2b2c80caf0 100644 --- a/docs/basic-features/data-fetching.md +++ b/docs/basic-features/data-fetching.md @@ -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.