Accessing data from an API is one of the most common things you will do in web development, and the way to access APIs is with fetch. Fetch is function built into JavaScript that allows you to query any URL/API to get back data. The most important part is that fetch is asynchronous so it will run in the background and let you know when it finishes using promises. In this video I will show you exactly how to use fetch, and all of the common mistakes people make using fetch so you can get up and running in just six minutes.
📚 Materials/References:
Learn Promises In 10 Minutes Video:
Async Await Tutorial:
🧠 Concepts Covered:
– What the fetch API is
– How to use the fetch API
– How to handle API response errors
– How to use JSON data with fetch
🌎 Find Me Here:
My Courses:
Patreon:
Twitter:
Discord:
GitHub:
CodePen:
#Fetch #WDS #JavaScript
Nguồn: https://thegioiinuv.com/
Xem thêm bài viết khác: https://thegioiinuv.com/lap-trinh-php/
How did u maintain that delivery speed with so much clarity.Simply amazing.
Could you please make a video explaining your setup, including how you avoid CORS errors?
Great tutorial. It helped me to understand how actually fetch works. Thank you
Axios solve all the problem above.. With third the code
wow love from Pakistan
thx man
Came here to learn fetch and ended up lost in your eyes. No homo
I'm not to sure how to make a javascript fetch URL where you paste it in the bar on a browser then it sends back the cookies
Imma just stick to axios for now.
Hey Kyle,
you really should blink man. I have been watching your videos for a long time now and you not blinking your eyes as often as they should always catches me off-guard. Just a suggestion, no biggies… 🙂
Excellent work
This is really helpful, thanks
Are you real?
I love that you are sensitive to developers time
short and concise
Are the DevTools on the right of your screen a Visual Studio Code extension? I'm trying to find it.
Brilliant!, Its short and precise.
Sir do u have tutorial on node js
Clear and straight forward. Thanks
You make good videos
very confusing for you to type stuff out and then go back and delete it and change it.
nice information
Thanks Kyle good overview BUT its IMPOSSIBLE to talk about all offer the api in 6 min
you for instance did not mention the finally block which was recently added to fetch (es-9 or es10 dont recall)
sometimes you would want to make appear again an html element whatever it was successful or in error:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/finally
very clean and precise , no waste of time 🙂
This is why dev love to use axios
hey is your last name "Reese" ?
after retrieving data from local file with fetch API, i want to work with that data, where to work?
Bravo!
My first ever video of your channel. Well explained in actually 6 mins. No bullshit.
PS: This is the first time I came across fetch. I have been using axios but NOW I think fetch is also nice!
This was very helpful, thank you very much!
Learn it in 3 minutes: x 2
You're a life saver man 👍🏽
This content should get you more views. Thank you brother. Great reviewing content too.
I wish you learn C# and make beckend tutorial with it…. You explanation is good…May peace be upon you
How do we fix the CORS error caused due to an API?
Your habit of staring unblinkingly into the camera is terrifying, but this tutorial is really helpful so I guess I'll just live with the nightmares.
Awesome tutorial! Congratulations!
Please, could you show us the content of the file located in https://reqres.in/api/users? I'm confused if I'm on the backend or the frontend
Simple and clear explanation. Thank you.
Instructions unclear, i destroyed my Fetch because he's a assassin robot
thank you bro for this tutorial.
i have this error Access to fetch at 'https://regres.in/api/users' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
fetch.js:3 GET https://regres.in/api/users net::ERR_FAILED
(anonymous) @ fetch.js:3
fetch.html:1 Uncaught (in promise) TypeError: Failed to fetch
Instructions unclear, ended up killing the neighbor's dog.
your videos should've appeared earlier for me they are very useful man, that only the second video I see in your channel and I am activating the bell Icon
The links to other videos were SUPER helpful. Thanks, man!
Great video kyle as all ways, Please make a video on RxJs operators and piping them.