Giphy API and Fetching Data

Fetching data from APIs can be done in several different ways with Next.js.

Introduction

As mentioned in the lesson, types of pre-rendering fetching data can be done in different ways. I want to help you understand which way will be the best for each page and show you examples using the Giphy API, in addition to talking about the pros and cons of each method.

Questions you need to ask yourself

  • Does my page require data?
  • Will the data change and need to be updated each time the page is loaded?
  • Will the data be used to create HTML that needs to be indexed by search engines?
  • If the data does not need to be indexed by search engines, is there an alternative to server-side rendering the page?

By asking these questions, you will determine the type of pre-rendering necessary for your page.

Giphy API key

The Giphy API key is used for the Giphy Search App that you will build throughout the course and for the examples that you will see in this specific lesson. I will show you here how to get your Giphy API key.

Go to this page: https://developers.giphy.com/

Click on the Get Started button.

Get hands-on with 1200+ tech skills courses.