LoadMore button that update variable 'page' in fetch URL inside getServerSideProps function.
Unanswered
Cinnamon posted this in #help-forum
CinnamonOP
Hello, I'm working on a side project in which I fetch data from an API using getServerSideProps function however I want to display more result and so update the page (next page or show more btn) but I still want to make the api call server side , can you guys help ? Thanks
1 Reply
CinnamonOP
I found a solution , I first use getServerSideProps to display the first page , then I use Api Route to update my state with the results of the next page : https://nextjs.org/docs/pages/building-your-application/routing/api-routes