Data Fetching in NextJS + Suspense / Loading
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
this may be a simple question but is getServerSideProps gone now? Im reading the docs and i don't see mention of it on the data fetching. Here are my questions:
1 )When fetching data can it only be done on server side code because of the async/await nature?
2) When using Suspense component and loading is it intended to wrap around client side code?
1 )When fetching data can it only be done on server side code because of the async/await nature?
2) When using Suspense component and loading is it intended to wrap around client side code?
3 Replies
Sloth bearOP
also i dont like to do any api calls on client side code especially in useEffect() because of past expeirences it seems to make several duplicate calls rather than one
Asian black bear
getServerSideProps is for pages router, not app router. do you have the docs toggled on app router?
@Asian black bear getServerSideProps is for pages router, not app router. do you have the docs toggled on app router?
Sloth bearOP
sorry for the late reply yes in fact I did have it toggled for app router , thank you so much for clarifying