I'm trying to fetch a users name from the JSON placeholder API and just simply display it but it seems to be coming back as undefined and not sure why. Any help would be great!
function GetServer({ data }) {
return (
<>
<h1>{data.name}</h1>
</>
)
}
export async function getServerSideProps() {
const res = await fetch(`https://jsonplaceholder.typicode.com/users/1`)
const data = await res.json()
return { props: { data } }
}
export default GetServer