Server Side Rendered Page with Data
Understand when to use server-side rendering in Next.js by learning to fetch data on each request. This lesson helps you handle dynamic routes and use route parameters to render up-to-date Giphy search results, improving user experience with fresh content.
We'll cover the following...
When should you server-side render a page?
A good way to judge if server-side rendering a page is the right page type for you is to ask yourself a few questions.
- Will the data change often?
- Is the most recent data important?
- Will the page use route parameters in order to determine which data it will retrieve?
If you answered yes to any of those questions, you will need to server-side render the page.
When HTML gets generated
Lastly, if you remember from a previous lesson, statically generated pages are created at build time. That means that when someone requests that page, the server has the HTML in hand and serves it to the user right away. When you are server-side rendering a page, the server creates the HTML for every request.
NOTE: In my experience, the server-side rendered pages ...