Callbacks, Promises, Async Await | JavaScript Fetch API Explained
Video Statistics and Information
Channel: Dave Gray
Views: 5,064
Rating: 4.9835391 out of 5
Keywords: callbacks promises async await, javascript fetch api explained, javascript, async await, callbacks, javascript promises, promises, async javascript, javascript tutorial, javascript callbacks, async, await, js promises, async await javascript, asynchronous javascript, javascript async await, async await js, javascript async, javascript promises explained, js async await, javascript await, fetch, fetch api, javascript fetch, javascript fetch api, fetch javascript, js fetch, api, apis
Id: VmQ6dHvnKIM
Channel Id: undefined
Length: 65min 4sec (3904 seconds)
Published: Tue Nov 10 2020
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
In this video, we will look at how to use Async / Await with the Fetch API. First, we have to understand the concepts of callbacks and promises. We also need to understand thenables and how async / await replaces them in our code. The first 30 minutes covers the concepts. The last 30 minutes gives examples of retrieving data from different APIs.
Subscribe ➜ https://bit.ly/3nGHmNn
✅ Quick Concepts outline:
Fetch API with Async / Await
(0:00) Intro
(0:29) What is a callback function?
(1:15) What is the problem with callbacks?
(3:00) JavaScript Promises have 3 states
(5:28) A promise may not return a value where you expect it to: You need to wait for a promise to resolve
(6:58) Using thenables with a promise
(20:15) An easy mistake to make with promises
(24:00) Creating an async function
(25:00) Applying await inside the function
(33:45) Example 1: Retrieving user data
(40:00) Example 2: Retrieving dad jokes
(47:00) Example 3: Posting data
(49:40) Example 4: Retrieving data with URL parameters
(54:55) Abstract it all into single responsibility functions
🤖 APIs used in the examples for this tutorial:
• https://jsonplaceholder.typicode.com/
• https://icanhazdadjoke.com/
• https://httpbin.org/
• http://www.icndb.com/api/
Was this tutorial about the JavaScript Fetch API, Async/Await, Promises, Thenables, and Callbacks helpful? If so, please share. Let me know your thoughts in the comments.
Async Await Javascript with Fetch API Examples: https://youtu.be/VmQ6dHvnKIM