...

/

Statically Generated Page with Data

Statically Generated Page with Data

You can generate pages with data statically. First, let's understand the best use case for this type of page.

When should I statically generate a page with data?

If you have a page that is going to use or display data from an API, but it does not necessarily have to look for updated data every time the page loads, then you can statically generate a page with data.

Let me give you an example using our Giphy Search App. I want to show users some giphys related to cats when someone lands on your home page. Any cat giphys will be fine to show. I am not really concerned if the Giphy API gets more cat giphys in the future and I am showing old ones. This is a good use case for generating a page statically with data.

When you run a build on your application, the page is generated with data at that time. The page is then served to users from a CDN.

How to implement

Let’s build out the functionality discussed conceptually above. ...