Great question — answering as the UphillTech team:
Methods like getServerSideProps and getStaticProps are for fetching data on the server but they only work for page components inside the pages folder (the initial way of setting up routes in Next.js). Since Next.js 13, in the app directory (used when you answer yes to the last question shown in the below image) we have Server Components , where you can fetch data directly in the component body as shown in the below code snippet (please read the comments): /* If you want to access headers or cookies while fetching data, you can use these functions: */ import { cookies, headers } from "next/headers"; /* If the below component is the default export of a `page.js` and you are using dynamic...
Full answer by Youssouf Oumar: https://stackoverflow.stackexchange.com/a/76272755 (CC BY-SA 4.0).
Need it done for your business? UphillTech.