React js Tutorial - How To Get Data From An API With React

Поделиться
HTML-код
  • Опубликовано: 4 май 2018
  • If you like this channel and would like to support it i accept bitcoin donations to my wallet address:
    1Fm3ZywfnioXjHpUbVppLvpzehvRq2vfQs
    Build native apps for iOS & Android with drag and drop:
    interactiveappbuilder.com/
    Featured Full Courses I Recommend To New Developers:
    React JS - The Complete Guide (over 150 000 devs enrolled)
    click.linksynergy.com/deeplin...
    React JS Web Development - The Essentials Bootcamp
    click.linksynergy.com/deeplin...
    The Complete React Js & Redux Course - Build Modern Web Apps
    click.linksynergy.com/deeplin...
    The Complete React Native + Hooks Course
    click.linksynergy.com/deeplin...
    React Native - The Practical Guide
    click.linksynergy.com/deeplin...
    The Complete JavaScript Course
    click.linksynergy.com/deeplin...
    Recommended VPS and dedicated servers for your hosting:
    www.vultr.com/?ref=8317938
    More Content:
    React JS Tutorial - Create A Simple Login System Episode #1 of #3
    • React JS Tutorial - Cr...
    React js Tutorial - How To Use localStorage and sessionStorage
    • React js Tutorial - Sa...
    HTML/HTML5 from beginner to expert:
    www.udemy.com/course/html5-in...
    In this tutorial from fullstack development you will learn how to fetch data from an API in React using Javascript and the fetch function.
    #keywords
    react js api call
    react js api
    fetch data
    api

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

  • @FullstackDevelopment
    @FullstackDevelopment  4 года назад +14

    Github repo for this application:
    github.com/nordin-johan/tutorial-reactjs-fetch

  • @OptimalTrainingGroup
    @OptimalTrainingGroup 4 года назад +7

    Thank you! This has helped me tremendously. I didn't understand how to SetState with asynchronous data and this helped a lot. Great job!!!

  • @reshaknarayan3944
    @reshaknarayan3944 5 лет назад +2

    Great. Looking for this for past one week. Saved my day. Thankyou , became a subscriber

  • @FullstackDevelopment
    @FullstackDevelopment  4 года назад +2

    If you want to post data as well: ruclips.net/video/8SkiIAbFbNs/видео.html
    Full Course For React JS - The Complete Guide: bit.ly/2oCrfH0

  • @michaelrurka9340
    @michaelrurka9340 5 лет назад +11

    Amazing video! Thank you so much for making this very simple and easy to follow! Perfect!

  • @alreadytakenindeed
    @alreadytakenindeed 5 лет назад +4

    Thank you so much for this tutorial!!! It solved a huge problem for me with data from response!

  • @NinadFaterpekar
    @NinadFaterpekar 4 года назад +25

    Thank you. this was very clear.
    the API fetch component starts at 4:00

  • @SocksWithSandals
    @SocksWithSandals 4 года назад +7

    End to end that was exactly what I need React for.
    Thank you.

  • @gcuwajidali262
    @gcuwajidali262 5 лет назад +1

    Too Much Love ...! This is what i was searching from basic to practical...!

  • @thatdumbguy2800
    @thatdumbguy2800 4 года назад +4

    This is exactly what I was searching for...thank you

  • @mauriciogomez6944
    @mauriciogomez6944 5 лет назад +2

    A great introduction into fetching API data and what it would look like on code! thank you!

  • @arifshoaib3239
    @arifshoaib3239 4 года назад +2

    This is What I Expected. Thank you :)

  • @palviczjan01
    @palviczjan01 4 года назад +21

    Thank you! You saved me from a mental breakdown with this tutorial... :D

  • @kamaboko1
    @kamaboko1 5 лет назад +1

    Easy-peasy to understand. Great job!

  • @bmejia220
    @bmejia220 3 года назад +1

    Thank you for the great tutorial. The tutorial is easy to understand. Liked and subscribed. :)

  • @cricket62200962
    @cricket62200962 4 года назад +3

    Great video, thanks for explaining things simply!

  • @bhavukjindal9432
    @bhavukjindal9432 4 года назад +1

    Great man exactly what I was looking for, Thanks

  • @fonncatalina6464
    @fonncatalina6464 3 года назад

    Thank you so much!! Subscribed immediately!

  • @ShankyBady
    @ShankyBady 5 лет назад +2

    Thank you so much, this is precisely what I was looking for.

    • @FullstackDevelopment
      @FullstackDevelopment  5 лет назад

      Thanks!

    • @ShankyBady
      @ShankyBady 5 лет назад

      @@FullstackDevelopment can you help me out with something? I'm sort of stuck.

    • @ShankyBady
      @ShankyBady 5 лет назад

      It's not related to this though, so if you wouldn't mind, I'll ask.

  • @CesarJuarezVargas
    @CesarJuarezVargas 5 лет назад +1

    Very useful for our "first steps". Thank you!

  • @wz5044
    @wz5044 4 года назад +1

    short video good explained, exactly what is needed ty a lot

  • @KeaganStRose
    @KeaganStRose 4 года назад +1

    You are amazing, thank you for your clear instructions.

  • @irshadhussain9663
    @irshadhussain9663 5 лет назад +1

    Thanks man great explanation as always :)

  • @anonymoussloth6687
    @anonymoussloth6687 3 года назад +11

    how can we do this with functional components in react instead of classes?

  • @nilsojr2790
    @nilsojr2790 5 лет назад +1

    Simple and objective. Great !!

  • @hosseinghadirzadeh4999
    @hosseinghadirzadeh4999 5 лет назад +1

    it was great and useful for me.
    thanks man

  • @anushkareddy1455
    @anushkareddy1455 3 года назад

    you just helped me with the exact solution thank you

  • @LawZist
    @LawZist 6 лет назад +1

    very good , simple and learning video! more of those :)

  • @siddharthpand8
    @siddharthpand8 5 лет назад +1

    Thank you for making this clear

  • @omid443
    @omid443 5 лет назад +1

    simple and helpful. Thank you.

  • @rachidbouali8511
    @rachidbouali8511 3 года назад

    thank you, this helped me a lot

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

    Thank you .This was very helpful 👍🏻

  • @sanjurj3278
    @sanjurj3278 5 лет назад +26

    great video .....this is what beginners need

  • @israelmanzo8725
    @israelmanzo8725 5 лет назад +1

    Very nice..!! Thank you for this tutorial.

  • @locnguyen-dv4ok
    @locnguyen-dv4ok 4 года назад +1

    Thank you so much ! It is very understandable

  • @dmkjava
    @dmkjava 5 лет назад +1

    Thank you, Useful info.

  • @ManishSingh-lk4qs
    @ManishSingh-lk4qs 5 лет назад +2

    Perfect ! Thanks Sir.

  • @sasikalanarayanasamy6096
    @sasikalanarayanasamy6096 5 лет назад +1

    Thank you so much. I have seen so many videos to fetch the data using API in React and worked like that but nothing is worked. But your tutorial is very easy to understand and it is working too. Thanks once again.

  • @madhavrw4273
    @madhavrw4273 4 года назад +1

    thanks for so much for this video, it solved my problem

  • @d3v3r_
    @d3v3r_ 3 года назад +1

    Thank you! I solved my problem! :)

  • @blendermaster8934
    @blendermaster8934 3 года назад +1

    Thank you,you saved my life!!

  • @murodalisharipov5929
    @murodalisharipov5929 4 года назад +1

    what if am doing routing in the return section then how do I pass items to other components? I want to render items in other components and use it there how do I do this? do i need to fetch data for each component in order to use it there?

  • @TheTibo69
    @TheTibo69 5 лет назад +1

    Amazing! thanks a lot!

  • @ksdnews6757
    @ksdnews6757 3 года назад

    thanks bro!!!! amazing and easily

  • @justdvl
    @justdvl 5 лет назад +3

    Thank you for this. It's clear and looks easy. Ivhabe a question about 1 thing. I don't understand line 20.. items:json. What is json? Variable? Where does it come from? Or does it come from an arrow function?

    • @alesklasek2308
      @alesklasek2308 5 лет назад

      adding return to the 1st .then(...), solves the problem:
      ---------------------------------------------------------------------------------------------------
      componentDidMount() {
      fetch("jsonplaceholder.typicode.com/users")
      .then(response => {
      return response.json();
      })
      .then(json => {
      console.log(`received data:`, json);
      this.setState({
      isLoaded: true,
      users: json
      });
      });
      }

  • @thepleasantdiariesridhi1567
    @thepleasantdiariesridhi1567 3 года назад

    Hi
    I have a collapsible in the HTML, and exactly similar code as you have shown here.
    I have 5 such components each calling an API response. All components call API on the load of the page.
    Like if API is responding 10 records then, i get 50 responses on each load.
    My question : is it possible to call the API only when user click on the collapsible header? So that My API responds only 10 on demand and not on each load.

  • @westfield90
    @westfield90 3 года назад

    Very helpful. Thank you

  • @Soap_js
    @Soap_js 3 года назад +1

    Thanks man 🤘

  • @culturapoliticaycomputador9999
    @culturapoliticaycomputador9999 3 года назад +1

    Thank you for this great video.🙏👌

  • @Anonimousxz
    @Anonimousxz 5 лет назад +1

    Many nice, thanks! :D

  • @DanielaBarrientos
    @DanielaBarrientos 5 лет назад +1

    Genius explenation! Great job Sr!! Thanks *1M

  • @DOUBLE0SEVUN
    @DOUBLE0SEVUN 5 лет назад

    Does anyone know how I would write the fetch() is I were accessing an API with a Bearer token?

  • @SudhirKumar-ov6ee
    @SudhirKumar-ov6ee 6 лет назад +1

    hi, i wan to use camera plugin, as well as contact plugin in react native, but i did not understand how to use it, plz guide me with coding.....i iam using ubuntu with android phone.

  • @TheBilverMax
    @TheBilverMax 4 года назад

    thx man, the best

  • @be-kreidly1515
    @be-kreidly1515 4 года назад

    very nice explanation method !

  • @danielsimonney8888
    @danielsimonney8888 5 лет назад +1

    Thank you very much, very useful.

  • @sourabhdubey2668
    @sourabhdubey2668 5 лет назад +2

    thank u and love .. now i know how to integrate api Hureeeeeeee

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

    thanks short and crisp .. :-)

  • @rizvidhk
    @rizvidhk 5 лет назад +1

    really good work.. thanks

  • @centrumsaiyan7623
    @centrumsaiyan7623 4 года назад +2

    After I have practice this. I think I am ready for my first frontend developer job.

  • @pjalmeida8732
    @pjalmeida8732 3 года назад +1

    Great job!

  • @ahmedbejaoui5015
    @ahmedbejaoui5015 5 лет назад +3

    thank you for this

  • @ShankyBady
    @ShankyBady 5 лет назад +8

    Hi, can anybody help me out? I have done literally the same thing, I can get an error items.map is not a function. I'm confused.

    • @FullstackDevelopment
      @FullstackDevelopment  4 года назад +5

      The map function work only on arrays, you are not retrieving an array hence the error.

    • @abhisheksharma8210
      @abhisheksharma8210 3 года назад +1

      for anyone looking for this ..........for eg. the array (object) in your JSON data is named as "students",inside which you would have named all id,age,name etc............So basically now as map function work only on arrays so you have to do items.students.map

    • @prathameshyerva248
      @prathameshyerva248 3 года назад

      @@abhisheksharma8210 thanks man

  • @rakeshreddy6719
    @rakeshreddy6719 5 лет назад +1

    hi it is very helpful and i need how to store form values into db backend springboot front end react js....its very important for me...

  • @vineet4991
    @vineet4991 3 года назад

    I hv a question. How do we connect our React app to backend like to Node js and then work on database maybe Mongo db. What if i don't wanna work with API then how?

  • @krishnabagale
    @krishnabagale 5 лет назад +2

    Thank you sir!

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

    What keyboard do you use? It sounds so dope!

  • @chetankumars333
    @chetankumars333 5 лет назад

    I have blob http response, so I need to store this into cache and it will help to call for the second click within the period of time instead of calling API again

  • @datasupervision943
    @datasupervision943 4 года назад

    Hello,I did same as you but a blank page is shown.no any data.a warning in console contains, deliver cookies with cross-site-requests....What to do in this case.plz suggest.

  • @andynguyen4676
    @andynguyen4676 3 года назад

    I did exactly like you instructed but data never fetched. I checked the webservice and data is returned from soapui as json format.

  • @marceloamado6223
    @marceloamado6223 4 года назад

    What is the color of the switches of your keyboard?

  • @rishikachowdarypotturu3488
    @rishikachowdarypotturu3488 4 года назад +1

    @Fullstack Development ...I've been getting error - Expected an assignment or function call and instead saw an expression no-unused-expressions..could you please help with it

    • @horaciogabriel3269
      @horaciogabriel3269 3 года назад

      Have you writen the return method correctly? I had same error once and the cause was return function.

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

    it's working when i use the api in the video, but when i use my api which is in the localhost it doesn't function do u have any idea?

  • @ferox6231
    @ferox6231 3 года назад

    Thank you sooo sook much for this, but how can i do this with function component?

  • @saherahussein1086
    @saherahussein1086 6 лет назад +1

    Hi, First of all, Thank you for all these informative videos.
    I just want to ask you for a devise, I want to start learning React Native, So what's the RoadMap you are recommended to follow until I will be able to do a complete task from zero,
    Also, can I working as a full time freelancer using it to built app , because in my country there is few to nothing jobs in this field.
    I will be more than thankful for your answer and time (:

    • @FullstackDevelopment
      @FullstackDevelopment  6 лет назад

      Hi thanks! I just launched a forum for this channel where you can get more answers from other people and discuss your questions: fullstackdiscussion.com/. I try to respond to as many questions as possible but there are just too many at the moment as the channel is growing quickly.

  • @kushaluk2381
    @kushaluk2381 5 лет назад

    how to use for loop and dispaly only few names

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

    could someone tell me how to retrieve data from edamam? there's plenty of tutorials on the 1st version but they've updated v2 and I can't get my head around it please help!

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

    How can we fetch data or table from sql server database to react application

  • @pneumachill1872
    @pneumachill1872 5 лет назад +1

    Error: Unexpected token < in JSON at position 0 - - The file that contains data is an XML
    Plz help

  • @dungnguyenvan9164
    @dungnguyenvan9164 4 года назад +1

    Tks you very much !

  • @andyyatma3642
    @andyyatma3642 5 лет назад

    How to set the api key on get method ?

  • @shudyshudy8681
    @shudyshudy8681 4 года назад

    thank you ver much

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

    is there a part 2? how do you access the address details?

  • @pooranivijay4042
    @pooranivijay4042 4 года назад +1

    What if I want to display one user from the array instead of listing everything?

    • @khushboosharma9717
      @khushboosharma9717 3 года назад

      You can use array filter() method to specify the condition.

  • @alexk.9670
    @alexk.9670 4 года назад

    How I can transfer that data in table?

  • @issaabdulaziz7771
    @issaabdulaziz7771 3 года назад

    But actually how the front end knows that url. I mean when he is building his app how can he knows actually the url that he should be using to fetch data.
    Does the back end built before the front end so the back end tell the front end what are the URLs that he should be fetching to get the data from.
    Or what's the case
    Please help me guys I'm little confused

  • @TruthSeekerClub
    @TruthSeekerClub 5 лет назад +3

    Back-end trainee here.
    Come to see how do you use my apis

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

    thank you so much

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

    thank you

  • @thatchert2159
    @thatchert2159 3 года назад

    I am getting items.map is not a function error

  • @ryansyd4224
    @ryansyd4224 3 года назад

    i'm getting an error: TypeError: items.map is not a function

  • @g43s
    @g43s 3 года назад

    my "isLoaded" variable is always undefined, anybody has the same issue?

  • @devfaded9351
    @devfaded9351 5 лет назад +1

    I keep getting items.map is not a function, is this not how you do it anymore in React?

    • @harmanpreetsingh3818
      @harmanpreetsingh3818 4 года назад

      maybe your api is not providing list of object diectly. So if there is any key in api where u r storing those object use that to access ex this.setState({data: json.list,isLoaded : true})

  • @davisvlogs3896
    @davisvlogs3896 3 года назад

    how to get array data from api as list?

  • @nicky4111
    @nicky4111 5 лет назад

    Thanks! And how to do it in separate component and send data here?

    • @ShankyBady
      @ShankyBady 5 лет назад

      pass jason as props? does that work? I'm also learning so I'm only trying to firgure it out.

  • @sam29sept
    @sam29sept 5 лет назад +7

    TypeError: items.map is not a function

    • @torrentinocom
      @torrentinocom 4 года назад

      sam yoyo its no deal of this video. Its just about fetching data from api. You can use 'for' cycle instead. Or just display few items from items list, smths like
      {items[0].name}
      {items[1].name}
      {items[2].name}
      Every else nuances its just pure JS, but in this video author covered actually retrieving data from api.

  • @jeffersonmayfield6701
    @jeffersonmayfield6701 4 года назад +1

    If you get .map is not a function, try adding the initial key name between data.map "data.keyname.map"

    • @okoyechiamaka4103
      @okoyechiamaka4103 4 года назад

      how pls

    • @jeffersonmayfield6701
      @jeffersonmayfield6701 4 года назад

      @@okoyechiamaka4103 you're data will have a key value pair. Data.map can change depending on what your data is called. Try some different combos.

    • @okoyechiamaka4103
      @okoyechiamaka4103 4 года назад

      Can you show me what it should look like

    • @jeffersonmayfield6701
      @jeffersonmayfield6701 4 года назад

      Provide the structure of your json

  • @ChongHwi
    @ChongHwi 5 лет назад +1

    I like this video

  • @rishabhunlocked2693
    @rishabhunlocked2693 4 года назад

    really nice content .....
    how can I put api key in this code? like google places needs api key...

  • @jitendarkumar-bl6yd
    @jitendarkumar-bl6yd 5 лет назад +1

    best video