We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19af948 commit d73ffb1Copy full SHA for d73ffb1
pages/ninjas/[id].js
@@ -1,3 +1,20 @@
1
+export const getStaticPaths = async () => {
2
+ const res = await fetch('https://jsonplaceholder.typicode.com/users');
3
+ const data = await res.json();
4
+
5
+ // map data to an array of path objects with params (id)
6
+ const paths = data.map(ninja => {
7
+ return {
8
+ params: { id: ninja.id.toString() }
9
+ }
10
+ })
11
12
13
+ paths,
14
+ fallback: false
15
16
+}
17
18
const Details = () => {
19
return (
20
<div>
pages/ninjas/index.js
@@ -11,7 +11,7 @@ export const getStaticProps = async () => {
}
const Ninjas = ({ ninjas }) => {
- console.log(ninjas)
+ // console.log(ninjas)
0 commit comments