While working on querying the parameter in the URL within getServerSideProps, I encountered an error where ID was undefined in the DetailThemepage function. My Next.js version is V.13 and the directory structure is app/detail/[id]/page.tsx.
http://localhost:3000/detail/xyz
export default async function DetailThemepage({ id }: { id: string }) {
//ID IS UNDEFINED
console.log("ID OF THE PAGE:" + id);
...
}
export const getServerSideProps: GetServerSideProps = async (context) => {
const { id } = context.query;
return {
props: {
id,
},
};
};
"getServerSideProps" is not a valid Next.js entry export value.