How to Display a Loader While Waiting for Server-Side Data Fetch in Next.js?
I’m working on a Next.js application where I’m using getServerSession
and getHotelAvail
to fetch data server-side in the Search
component. However, when the user submits the search form, the page waits on the form (even though an url is pushed) and only when getHotelAvail
finishes, the Search
component with the fetched data renders. This causes the user to experience a delay without any feedback that the data is being loaded.