Getting an "undefined" value when calling the getServerSideProps function in Next.js 13
Like this:
Data is: undefined
Error: When I go to console the data in default export it shows an undefined
export default async function page({data}) {
console.log("Data is: "+data);
return (
<h1>`Test page`</h1>
)
}
export async function getServerSideProps() {
const response = await fetch("``https://dummyjson.com/users``");
const data = await response.json();
return {
props: {data},
}
}
I want us to get an object that has an array name users which contains the user's data.
That's all I want.