Dynamic routing with getServerSideProps in Nextjs

export async function getServerSideProps(context) { const { id } = context.query; const res = await fetch(`https://restcountries.eu/rest/v2/name/${id}`); const country = await res.json(); console.log(`Fetched place: ${country.name}`); return { props: { country } }; } you are returning a nested object from above function { props: { country:country } } so this prop will be attached to props … Read more