api data fetching with serversideprops in nextjs not working
Unanswered
American Sable posted this in #help-forum
American SableOP
im trying to fetch api data from postman to my nextjs project with serversideprops but this shows up, how do i fix it?
10 Replies
@American Sable im trying to fetch api data from postman to my nextjs project with serversideprops but this shows up, how do i fix it?
props.product is undefined, as the error says@joulev `props.product` is undefined, as the error says
American SableOP
umm yea how do i fix it bro?im kinda new at this
@American Sable umm yea how do i fix it bro?im kinda new at this
oh didn't notice at first, could've given you a more helpful answer
since you are using the app router you simply don't have getserversideprops. instead use server components: https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#server-side-rendering-getserversideprops
since you are using the app router you simply don't have getserversideprops. instead use server components: https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#server-side-rendering-getserversideprops
@joulev oh didn't notice at first, could've given you a more helpful answer
since you are using the app router you simply don't have getserversideprops. instead use server components: <https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#server-side-rendering-getserversideprops>
American SableOP
i really appreciate the help but do you have any video that can tell me exactly how to solve it?that would make life more easier
@joulev oh didn't notice at first, could've given you a more helpful answer
since you are using the app router you simply don't have getserversideprops. instead use server components: <https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#server-side-rendering-getserversideprops>
American SableOP
like how do i set it up
@joulev oh didn't notice at first, could've given you a more helpful answer
since you are using the app router you simply don't have getserversideprops. instead use server components: <https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#server-side-rendering-getserversideprops>
American SableOP
so if i re-install the project without the app router will i be able to use getserversideprops???
@American Sable so if i re-install the project without the app router will i be able to use getserversideprops???
if you use the pages router then you do have getserversideprops; if you want to use the pages router then just create it
make a
pages/index.tsxand make your page there