import Link from 'next/link'
export const getStaticProps = async () => {
const res = await fetch('https://jsonplaceholder.typicode.com/users');
const data = await res.json();
return {
props: { ninjas: data }
}
}
const Ninjas = ({ ninjas }) => {
// console.log(ninjas)
return (
<div>
<h1>All Ninjas</h1>
{ninjas.map(ninja => (
<Link href={'/ninjas/' + ninja.id} key={ninja.id}>
<a>
<h3>{ ninja.name }</h3>
</a>
</Link>
))}
</div>
);
}
export default Ninjas;
this is my code, how can I solve this error, I want to map data of json place holder to be map. I have tried a lot but it is not solving. I want to implement dynamic routing in next js. I am new in it. please help me