API Tutorial - Fetch Data with Axios - (Example in React)

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Tutorial on how to make API calls to fetch data using axios. I'm using React in this example, but you'll know how to use axios anywhere 👍.
    Hope it helps!
    Feel free to say hi 👋:
    twitter: / techcheck__
    blog: dev.to/techcheck
    IG: / techcheck__
    Thanks for watching!
    -Andrew
    ❤️ Buy me a coffee/say thanks/support the channel ❤️: www.buymeacoff...
    Affiliate links to some of my gear 🤘🙏❤️
    (Best quality for the best price from my research)
    Awesome Accent Lights 😎: amzn.to/3UCaHvO
    Maono Microphone: amzn.to/3SxAVN6
    Logitech Webcam: amzn.to/3OyIORm
    Rival Mouse: amzn.to/3OwYFzG
    Wrist Pads: amzn.to/4bplhfn

Комментарии • 144

  • @KazmaAttack
    @KazmaAttack 2 года назад +42

    you're a lifesaver man. it's such a pain in the ass finding a simple, straight to the point video. this is exactly what i needed, thank you

    • @techcheck3042
      @techcheck3042  2 года назад +1

      Got you! I'm very glad to hear that. Thank you for watching and for the awesome comment

  • @christianyepez3425
    @christianyepez3425 Год назад +39

    It's 3:38am this is the only striaght to the ponit video I found. I can finally get some sleep. Thank you for your work .

  • @prabhurao2773
    @prabhurao2773 2 года назад +6

    dude you made my day , " i have been falling for 24 hrs { thor : ragnarok loki reference } " with the same level of his frustration {loki} , cause i haven't been able to understand async await , fetch , try , catch , and the axios, i don't understand why there are so many ways man .... dammm these past 7 minutes are by far the most important 7 minutes in my entire 1 month of trying to understand api journey so far, all the big youtubers teach for super advanced devs but none of them know that 90 percent of their fan base are new / junior devs who are starting off and there is so much data out there that things might get overloaded that we end up not learning a very important skill. thanks mate. you have a new sub !!

    • @techcheck3042
      @techcheck3042  2 года назад +1

      Wow that's so incredible to hear and totally made my day! That also makes me feel very inspired to make more videos. Next few are dedicated to you my friend! So glad I could help! And funny reference 😂😂

  • @gamingtrpro
    @gamingtrpro 9 месяцев назад +3

    Not gonna lie i probably watched thousands of tutorials on different subjects, and this one might be the coolest

  • @SonnyTechAcademy
    @SonnyTechAcademy Год назад +4

    well explained. Thank you! Much love from Ghana

  • @tomasburian6550
    @tomasburian6550 2 дня назад +1

    I need to sell axios to my company's project's architect as a better way to fetch data, you helped me a lot. Thanks.

    • @techcheck3042
      @techcheck3042  2 дня назад +1

      @@tomasburian6550 awesome to hear! Thanks for the comment! Glad it helped

  • @anas980
    @anas980 2 месяца назад +1

    Great video! very well explained and I like the example with the button, it makes it easier to understand for beginners like me

    • @techcheck3042
      @techcheck3042  2 месяца назад

      Love to hear that! Glad it helped and happy coding!

  • @Samuel54-Diriba
    @Samuel54-Diriba 9 месяцев назад +1

    I am from Africa , Ethiopia. Bro i'm so proud to you! you're very amazing for me in all of your tutorial videos. I had started this tutorial 1-15 parts & now i finished it. GOD bless you
    & also i will be your members !!! keep it up wow.

  • @arietalzah5842
    @arietalzah5842 5 месяцев назад +2

    Damn everything I needed in tenminutes with no bull! Subscribed!

  • @thomaspisfil3594
    @thomaspisfil3594 Год назад +2

    "pretty much the most inspirational thing I've ever heard in my life" 🤣 great video man 🙏

  • @adhdmc
    @adhdmc 11 месяцев назад +1

    You, are a god send. Seriously thank you so much for this.

    • @techcheck3042
      @techcheck3042  11 месяцев назад

      Hahaha my pleasure! Glad it helped!

  • @Usman._
    @Usman._ 9 месяцев назад +1

    Need more content. This Chanel is good. Thanks for straight forward stuff.

  • @benjaminjvredevelt
    @benjaminjvredevelt 2 года назад +2

    thats deep && pretty much the most inspirational thing i've ever heard in my entire life

  • @Lifeofrandomness
    @Lifeofrandomness 11 месяцев назад +2

    It's awesome. Straight to the point. Thanks man!👍

  • @Odidi_Bee6ix
    @Odidi_Bee6ix Год назад +1

    Heyo best Axios tutorial hands down in a short time.. thanks man🖤🖤🙌🏾

    • @techcheck3042
      @techcheck3042  Год назад

      Wow, thank you so much! ❤️❤️ Glad it helped! 🎉

  • @yashpaota
    @yashpaota Год назад +2

    Such a simple and on point explanation of the topic.Great work.

  • @SuicideDog
    @SuicideDog 6 месяцев назад +1

    That cracked me up. "That's deep". Thx for a terrific vid

    • @techcheck3042
      @techcheck3042  6 месяцев назад

      🤣🤣 My pleasure and thanks for watching! Appreciate the comment 🙏

  • @iC7Zi
    @iC7Zi Год назад +1

    Nice one. Top G 🔥

  • @Electro_69
    @Electro_69 3 месяца назад +2

    Best video in the world😁

  • @SuperMBARutgers2013
    @SuperMBARutgers2013 Год назад +2

    This is so detailed and clear and succinct.

  • @CodeWithBehram7497
    @CodeWithBehram7497 6 месяцев назад +1

    To the point loved ur content

  • @chriscutie7892
    @chriscutie7892 Год назад +1

    Excellent straight to the point video

  • @arsh2544
    @arsh2544 Месяц назад +1

    its 2AM in the morning, I was thinking to go sleep. But then I read the final quote "Once you choose hope, anything's possible"

  • @Mullai333
    @Mullai333 6 месяцев назад +1

    Dude, your content is precise 🔥
    For ur work - Subscribed 🔔

    • @techcheck3042
      @techcheck3042  6 месяцев назад

      Thank you so much! Glad you like!

  • @ayushs6812
    @ayushs6812 2 месяца назад +1

    quick and easy. thanks

    • @techcheck3042
      @techcheck3042  2 месяца назад

      Glad it helped! Thanks for watching 🙂

  • @brett3554
    @brett3554 2 года назад +5

    amazing tutorial, clear and no in your face bs.

  • @daniel5242
    @daniel5242 Год назад +1

    While watching this video, I was just smiling 😁. Thank you. BTW, I'm also subscribing now!

  • @justme364
    @justme364 2 года назад +2

    Solid tutorial man good job!

  • @Fhoas
    @Fhoas Год назад +1

    Good, simple, understable thank you bro.

  • @turnpikemachine
    @turnpikemachine Год назад +2

    Amazing straight to the point video. Thanks.

  • @kunalbiswas372
    @kunalbiswas372 2 года назад +3

    to the point and simple...thanks a lot

    • @techcheck3042
      @techcheck3042  2 года назад +1

      Thanks for the compliment and thank you for watching

  • @jenkov2155
    @jenkov2155 10 месяцев назад +1

    As everybody said, excellent tutorial.

  • @sethodior2212
    @sethodior2212 Год назад +1

    Straight to the point, I’ll buy you a Lamborghini one day

    • @techcheck3042
      @techcheck3042  Год назад

      Haha hell yeah! Looking forward to it, thanks!

  • @joelsjunk239
    @joelsjunk239 Год назад +1

    This helped me a ton! Thanks so much.

  • @mikey-dubs
    @mikey-dubs 7 месяцев назад +1

    This was deep.
    Thank you

  • @viniciusmantovani8619
    @viniciusmantovani8619 2 года назад +1

    You are awesome.... I needed this for a project and you helped a lot. I just need to find out how to resolve CORS policy on my api right now 😅

    • @techcheck3042
      @techcheck3042  2 года назад

      Thanks! CORS policies are always such a pain 😂😭

  • @siddhantmaharana3936
    @siddhantmaharana3936 Год назад +1

    Thank you so much. this helkoped me a lot

    • @techcheck3042
      @techcheck3042  Год назад

      Awesome to hear! Thanks for watching and thanks for the comment!

  • @mosheheliyahu9071
    @mosheheliyahu9071 Год назад +1

    🤣Love your appreciation of the "deep" quotes... 🤣

  • @momokee2394
    @momokee2394 Год назад +1

    thanks Andrew

  • @amatajmartins1493
    @amatajmartins1493 8 месяцев назад +1

    Too good I have to Subscribe 👍

  • @guitarDad100
    @guitarDad100 Год назад +1

    Very nice lesson. Thanks for sharing.

  • @CharlieDEVGT
    @CharlieDEVGT 5 месяцев назад +1

    thank you for the video !! one question, how could i make a list of quotes from this example ?? i mean how to store each call to store in an array (let's say 7 random quotes instead of 1)

    • @techcheck3042
      @techcheck3042  5 месяцев назад +1

      Thanks for watching! I just looked at the API documentation - it looks like you can send a GET request to the same url, but /quotes instead of /random - that will give you an array of quotes.
      docs.quotable.io/docs/api/b8b96bc546285-get-quotes-with-author-details

  • @NawImNate
    @NawImNate Год назад +1

    Thanks for this

  • @sehjotsinghguram.1801
    @sehjotsinghguram.1801 2 месяца назад +1

    somebody give the sloppiest head to this man for making this. absolutely fucking awesome.

    • @techcheck3042
      @techcheck3042  2 месяца назад

      @@sehjotsinghguram.1801 😂😂🎉🎉

  • @v1betime852
    @v1betime852 Год назад +1

    Such inspirational content!

  • @HayrullaRuzimov
    @HayrullaRuzimov 18 дней назад +1

    Alhamdulillah that worked for me!

  • @ahmedbousaleh1018
    @ahmedbousaleh1018 Год назад +1

    that was pretty simple and funny as well

  • @MidhunSandhya
    @MidhunSandhya Год назад +1

    wow❤. Strating to the point. Thanks a lot.❤

  • @successezeh2009
    @successezeh2009 2 года назад +1

    Very educative and inspiring tutorial.👏👏

    • @techcheck3042
      @techcheck3042  2 года назад

      Glad to hear it! 🎉 Thank you! 🙏

  • @rogermorales5990
    @rogermorales5990 Год назад +1

    Great video

  • @camilotello3296
    @camilotello3296 5 месяцев назад

    Thank you very much :)

  • @kacper-bm5ur
    @kacper-bm5ur Год назад +1

    Dude i love you

    • @techcheck3042
      @techcheck3042  Год назад +1

      Hahaha. Love you too!

    • @kacper-bm5ur
      @kacper-bm5ur Год назад

      @@techcheck3042 staying for longer for sure, i learned this in 7 minutes and i couldn’t understand it for a week hahah

  • @freeyourmind7538
    @freeyourmind7538 5 месяцев назад +1

    Whats the difference between axios and JS fetch?
    The only difference i can see is fetch word changed to axios, am i missing something here?

    • @techcheck3042
      @techcheck3042  5 месяцев назад

      Axios is just easier to work with and has a lot of nice built-in behaviour like throwing errors on 400 and 500 response codes and auto-parsing JSON; you have to implement this yourself with fetch.
      Axios allows you to easily create dedicated HTTP clients with headers, a partial URL, etc built in so you don't have to supply them every time; you'd have to implement this yourself with fetch. This is very useful if your application needs to talk to multiple APIs.

    • @freeyourmind7538
      @freeyourmind7538 5 месяцев назад

      @@techcheck3042 thanks for the response, axios seems like a winner amongst many, it seems like i need to add it to my arsenal.
      Will defo look into implementing it my learning

  • @ahmedpatel408
    @ahmedpatel408 2 года назад +1

    great tutorial

  • @developer_hadi
    @developer_hadi Год назад +1

    Can you explain the difference between axios and fetch?

    • @techcheck3042
      @techcheck3042  Год назад

      They're basically the same thing with different syntax. Axios is a package that you have to install, but fetch is native to the browser so you don't have to install anything. But axios is easy to install, it's a small installation so it won't hurt, it comes with some extra features (which you typically don't have to worry about), and mainly - it's just easier to work with than fetch. Most web developers prefer to use axios 👍

  • @omckarbadekaar
    @omckarbadekaar Год назад

    i am getting an error
    TypeError: axios__WEBPACK_IMPORTED_MODULE_2__.default.get(...).this is not a function

  • @suprabhatkumar5478
    @suprabhatkumar5478 2 года назад +2

    its deep😂😂.. btw video was helpful..

    • @techcheck3042
      @techcheck3042  2 года назад +1

      🤣🤣. Glad to hear it!

    • @suprabhatkumar5478
      @suprabhatkumar5478 2 года назад +1

      @@techcheck3042 wish you make complete hooks tutorials like this masterpiece 😅😇

    • @techcheck3042
      @techcheck3042  2 года назад +1

      @@suprabhatkumar5478 thanks so much! I have a video for all of the common hooks and a custom hook: useFetch 👍🍻

  • @neoarya4919
    @neoarya4919 2 года назад +1

    That's feel easy peasy 😌

  • @Achilleas_1996
    @Achilleas_1996 Месяц назад +1

    im trying to make a weather app , and its my first time trying to fetch an api , the guy in the video uses an .env file , what is its use

    • @techcheck3042
      @techcheck3042  Месяц назад

      The .env file is for placing environment variables. Those are variables used for sensitive data (like API keys) that you might not want to show publicly. So it'd show the environment variable instead.
      I have a video on how to set those up here: ruclips.net/video/-oJ3sAthWg4/видео.html
      and actually a video on how to use a weather api here: ruclips.net/video/S_py2rXNizo/видео.html
      Happy coding!

    • @Achilleas_1996
      @Achilleas_1996 Месяц назад

      @@techcheck3042 thanks a ton. I'll go watch them now

  • @mamadikaba8516
    @mamadikaba8516 2 года назад +1

    Thank a lot !

  • @yigitogulbayarlar7138
    @yigitogulbayarlar7138 Год назад +1

    Thnks a lot , its a great tutorial man ! Can you share the source code ?

    • @techcheck3042
      @techcheck3042  Год назад

      Thank you! And sure! Once I’m back at my laptop

  • @ogazboiz
    @ogazboiz 2 месяца назад +1

    Why don't you use res.json

    • @techcheck3042
      @techcheck3042  2 месяца назад

      Axios takes care of that for us! 🎉

  • @thehuseein
    @thehuseein 2 года назад +1

    clear as fuck, loved your ending song

    • @techcheck3042
      @techcheck3042  2 года назад

      Thank you! Marvel Years - Check The Vibe 🤙

  • @yugeshkk3062
    @yugeshkk3062 2 года назад +1

    how to get the array values from json.

    • @techcheck3042
      @techcheck3042  2 года назад

      const array = [1, 2, 3].
      Inside your render function you'd open a bracket to write JavaScript and map over the array. For each return of each item, you'd return html and other brackets for each data item from the array.
      { array.map(num => (
      {num}
      ) }

    • @yugeshkk3062
      @yugeshkk3062 2 года назад +1

      @@techcheck3042 Thanks man

  • @farashafarasha5833
    @farashafarasha5833 8 месяцев назад +1

    What about api key?

    • @techcheck3042
      @techcheck3042  8 месяцев назад

      Not all APIs need an API key, but you would typically save that to an environment variable and use the env variable when/where needed.
      I’m going to make some more videos for different APIs. I’ll cover API keys on one that needs it! Likely the Google Maps API 👀

    • @farashafarasha5833
      @farashafarasha5833 8 месяцев назад +1

      @@techcheck3042 thank you

  • @sxuwrr
    @sxuwrr 4 месяца назад +1

    "is deep" 💀

  • @AdnanKhan-yg4ng
    @AdnanKhan-yg4ng Год назад +1

    thx nigga