Getting Data After a Page is Loaded

Pre-rendering as much of the page, as you can is great but what about the times that you need to get information from the user to determine what to display? Of course, this is possible and what we will be covering in this lesson.

We will use our index.js page, which is a pre-rendered page with data. We fetched some cat giphy’s from the giphy API in a previous lesson.

NOTE: Any type of page can get data asynchronously after the page is completely loaded on the client.

What you are trying to do is replace the server-side rendered page with data you fetch from your client based on a search term our user will supply.

Storing pre-rendered data in state

Before accomplishing your goal of getting giphys based on the users’ desire, you need to modify the existing code a little bit.

Get hands-on with 1400+ tech skills courses.