before learning how to use fetch we need to understand the word . A little googling define fetch as to go and bring back; return with; get. To translate that to the programming world fetch means to retrieve data by a software program and move the data to an alternate location or display it on a screen.

Fetch structure

Here is the structure code of how to fetch

Fetch argument is a string URL. fetch can also have an optional second argument that includes information regarding the request you want to make to the database or API.

The first .then statement is always the same! It parses out the returned promise in JSON.

the second.then gets the response type and return’s it, the data from the API is being logged to the console via the the second promise in the Fetch request.

An example

Anissa Guembre

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store