This is by far the most straight forward tut on api calls I've ever seen, well done man!
@cucucucucumber4 жыл бұрын
Two years later and this tutorial still helps me
@agamjotsingh73713 жыл бұрын
Me too!!
@sirrobinhood34094 жыл бұрын
Totally new to React. I have been screwing around with trying to make a fetch POST working for a week. From CORS issues to goofy ways to get at response json with 18 .then statements or catching error types. YOU ROCK! Thanks a ton!
@astrotoaster55554 жыл бұрын
This is the simplest way of getting things done, now I have my php backend with mysql and my frontend with react, thanks a lot. subscribed!.
@greygoose7444 жыл бұрын
Yo bro .I m trying to do same but instead of using JavaScript native fetch,I m using an API library called Axios for API call but I m getting 404 not found ,
@alpsprajapati3 жыл бұрын
Really quick and easy to understand. No story, direct to the point. Thanks
@push-to-talkpodcast28643 жыл бұрын
yah man. this is it. really simplified instead of making it seem super technical. nicely done
@travenishere60634 жыл бұрын
Really well done tutorial. Love it when you get to see real code working and also have an explanation to why certain things are done the way they are done!
@dragonburger56764 жыл бұрын
Love your style of tutorials! To the point and not wasting anytime. And you clearly know what the heck you are talking about
@eldiablorojo4 жыл бұрын
I’ve been searching the web for the best way to do this for over a week now and with my limited ability found it really difficult to understand. This explanation and example was so simple and straight forward I was able to start my app and have the data displaying... thank you! 🙏🏼
@darrionwhite15633 жыл бұрын
Bro! I am mind blown! You just made that seem so easy! After watching this, I feel confident about my junior technical interview coming up. Thank you so much!
@huangyan84092 жыл бұрын
You are really my big help! searching online for whole day in the end your video is truly my answer!
@pjcodes4383 жыл бұрын
Love it. Awesome video Ben! Also love the INSANELY fast typing speed haha.
@firasalkhatib57784 жыл бұрын
well done ,.... straight , fast , and clear ,, thats how should all the tutorials should be , thanx for ur effort ,
@tenshuohm79873 жыл бұрын
I love your tutorials because they are straight forward. Thanks, man!
@g43s3 жыл бұрын
simple, straight to the point, well explained, 10/10
@joe_3y3s5 жыл бұрын
these tutorials are just so great - really helping me gain familiarity and confidence with React - THANK YOU!
@paulmoustakas64223 жыл бұрын
Thanks a lot Ben! I agree with Zachary Doobs below, the most straight forward tutorial ever seen. First time i really understand the logic of JS. Ty !
@abhishekprasad63173 жыл бұрын
Thank you so much. was stuck from like 12 hours on this, I had to make componentdidmount async and then errors errors and errors. this video and the loading featured helped like wow thanks again
@skinpotatoes3 жыл бұрын
BY FAR THE MOST STRAIGHT FORWARD TUTO !! Yo bro !! i spent one week on udemy s**ts without issue .... thumb up
@nirvanacore55434 жыл бұрын
after struggling with axios finally this helped.. Thanks for sharing
@TimothyVandeweerd2 жыл бұрын
Thank you, well explained and just what I was looking for. I appreciate you sharing your knowledge.
@Intskints4 жыл бұрын
Just found this channel and I am amazed by your content. Was also looking to learn some React and this is perfect :D. You'll probably be the channel that has 500k subs next year. Keep up!
@tiekto42535 жыл бұрын
My man, well done. Structured, clear, informative. 10/10
@bawad5 жыл бұрын
Thanks
@MN-fl3hb3 жыл бұрын
Best tutorial I’ve seen so far. Excellent!
@cicciopasticcio84695 жыл бұрын
Thanks, brilliant, simple, short, I loved it
@TheYakMaster4085 жыл бұрын
Thanks for making this video so straight forward and under 10 mins! Your the man!
@Mysterious_debris_11115 жыл бұрын
I dunno why but i find your videos immensely satisfying. I can dedicate my whole life watching u coding
@bawad5 жыл бұрын
Well you're in luck, I have quite a few coding videos
@lucywakai3 жыл бұрын
This video is the best. Well explained. Thank you for sharing your knowledge :)
@adityamarzuk5970 Жыл бұрын
This is what i need others video teach with their finished apps
@SocksWithSandals4 жыл бұрын
That was a great, clear example.
@tamer79544 жыл бұрын
Super straightforward and concise tutorial. Thank you!
@uzairabdullah2084 жыл бұрын
Really helpful, lots of thanks from Pakistan!
@DanteMarinho4 жыл бұрын
Very nice and clean tutorial. Thanks.
@thomasrichter31853 жыл бұрын
heyo! I do comment quite rarely, but you really just saved me! liked and subscribed buddy
@rishabhagrawal45603 жыл бұрын
Nice!! Never thought it is this much easy
@Bitbeq3 жыл бұрын
Great tutorial. Straightforward and well done!
@sylviaf.66882 жыл бұрын
Do you have a tutorial on getting an api when the api is in an object and not an array? This tutorial is awesome by the way, helped clear up a lot of the concepts I had confused.
@daviddonadze2216 жыл бұрын
thanks a lot bro. just starting react and u are a huge help. 👍👍👍
@vivekm.13744 жыл бұрын
@benawad Hi Ben I could see the data in the console.log(data.results[0]) but when is set this to state in setstate like person: data.results[0] And inside return in render function I try to display it using the same syntax in video it is showing as cannot read name property of null {this.state.person.name.title} Can anyone help me please
@icyrealm74 жыл бұрын
Great vid! Straight and to the point!! Thanks.
@vsevolodpokhvalenko47054 жыл бұрын
Thank you!!!! You've rescued me🙏🙏
@agamjotsingh73713 жыл бұрын
You just got a new subscriber!
@thatsfinn3 жыл бұрын
I got several minutes into this tutorial before realizing this was Ben Awad..
@socialkruption3 жыл бұрын
reason?
@Ya55-yy3 жыл бұрын
Great content, well done!
@MatthewTorontoParis4 жыл бұрын
love to explain complicate concept with simple example!
@andrewnleon2 жыл бұрын
I would recommend custom hook and functional component. Do we sort from api or from code in js?
@TaronSarkisyan3 жыл бұрын
Awesome work! Thanks
@adnanhaider6843 жыл бұрын
Very helping, I was stuck from 2 days now. Now thanks I figure out from this video. Query=> "But how can we do if we have to show data in the list??"
@jindon276 жыл бұрын
Hi Ben, thank you for these nice tutorials. Really like how you teach. Learning a lot. Can you please include proper authentication with react using JWT (production ready), if it is possible. Thank you once again. Keep up the great work good Sir.
@daksh_sagar6 жыл бұрын
Yeah, would like that too, production grade auth.
@bawad6 жыл бұрын
I think I will do a tutorial with that and firebase in the near future
@Albertmars326 жыл бұрын
i would like that as well, also would appreciate if you integrate stripe too
@daksh_sagar6 жыл бұрын
But please no Passport, there are plenty of resources for passport and I do not like it at all. If you could create some sort of middlewares that could be dropped into any route to make it a protected one.
@bawad6 жыл бұрын
Have you seen the addUser middleware function: github.com/benawad/slack-clone-server/blob/53_deploy/src/index.js#L80
@riddhesh263 жыл бұрын
Loved this. StraightForward Api calls. Can you make a video which uses Axios for Api calls ? thanks
@joelrojas69702 жыл бұрын
Excellent thank you🙏
@Prim3MavericK4 жыл бұрын
Is there an updated version of this with React Hooks? If not, can you make one pls?
@EidosGaming3 жыл бұрын
You'd just use useEffect(..., []) to fetch the data and set your state
@zakidz67163 жыл бұрын
@@EidosGaming i did the samething with a function component but the problem is that the function keep running and updating the results edit: i found the solution add an empty array to the second argument of useEffect function to make it run once
@JO-dr4dr3 жыл бұрын
Best video on youtube
@user-ew3sb8lu7d3 жыл бұрын
Great video ….we don’t need to install json-server right ?
@rishabhtripathi35693 жыл бұрын
I am thankful to you brother
@DatCrossGuy5 жыл бұрын
Awesome tutorial, do you have one for posting data from a from to a server using react?
@bawad5 жыл бұрын
Only with GraphQL
@Codefide3 жыл бұрын
Beautifully explained thanks! Any follow up on this to do with looping round and rendering multiple persons?
@stunna44983 жыл бұрын
ben do you prefer class style components or functional components?
@PrathamGupta24084 жыл бұрын
When the line was getting big, it reformatted into multiple lines. Which extension did you use for this?
@shloaksaxena72794 жыл бұрын
probably prettier
@noelcovarrubias74904 жыл бұрын
Hello, is there a difference between the type of component that you're using and this type: import React from "react"; function MyComponent(){ return Hello World } ? I ask because I am trying to learn to fetch data and the code seems so different from the one I learnt.
@matasinp924 жыл бұрын
Thank you man., the best tutorial, I have ever seen
@Dude-iz2dw5 жыл бұрын
how do you view json in chrome 0:18? which extention do you use? I just get a plain string :-(
@extremespartan1175 жыл бұрын
This was a big help! Thank man!
@sneakdotberlin70854 жыл бұрын
This might be a dumb question, but let’s say the final rendered container is a significant fraction of the page. How do you keep the “loading” or “error” render the same size as the final rendered version so everything doesn’t jump around in the layout? Is there some CSS best practice for forcing the exact dimensions so the loading message/spinner element renders to the exact same size as the final response once the API data comes back?
@eotikurac4 жыл бұрын
can i fetch on button click or do i have to use componentDidMount hook? i tried doing this for the past two days but cannot get it to work the way i want. i get flooded with error messages that i can't interpret properly.
@ContortionistIX3 жыл бұрын
Hi, you named the component "FetchRandomUser", but essentially it's a "User" component that fetches some stuff. Is it normal for React components to casually fetch stuff or is there a orthodox way to structure this so that a service component fetches things for the main component?
@zlackbiro5 жыл бұрын
Very clear and nice. 🙂
@NAEL4SLR2 жыл бұрын
Thanks for sharing
@westfield904 жыл бұрын
Such a great video. Thank you
@benjaminsanchezlopez32663 жыл бұрын
Hi, incredible video! Can i ask you a question? Can you for example create a loop and print all the data into a list? And can you make that list a href for taking you to another page? thank you very much
@boo52743 жыл бұрын
Could you show a way of doing this within a functional component?
@binutil6 жыл бұрын
Hey Ben, love your tutorials. Can you maybe do one for React and D3? The react way of implementing it. There is so less material out there on that subject.
@bawad6 жыл бұрын
thanks, I haven't tried D3 yet, but when I do I'll make a tutorial on it
@altituszalex48894 жыл бұрын
Hi the tutorial is transmitting clear and sharp.Can you add how to get(fetch) only single user? by id or by name?
@gloriareyes65564 жыл бұрын
something that is a functional component instead? Would that be diff??
@ironears4 жыл бұрын
Thank you, that was excellent!
@ds28564 жыл бұрын
Nice demo. What is the IDE you have used for reactJs?
@bawad4 жыл бұрын
vscode
@momonkha58464 жыл бұрын
thank you good man, when I grow up I want to be like you ;D
@nick_jacob3 жыл бұрын
Thanks for this. I was using RapidAPI and they generate the syntax to follow but it doesn't work. This simplifies everything. I'm going to keep practicing because I understand this the least and always avoided it.
@Johnny_1305K5 жыл бұрын
Hey Ben, Really good stuff, all of your videos! I'm having a problem with the spacex api for a while now. I can fetch the api and log all its data (as a single launch) so this works..... console.log(this.state.launch) -> "huge object and this works ... console.log(this.state.launch.rocket) -> nested rocketObject This doesnt work. console.log(this.state.launch.rocket.rocket_id) -> undifined but the rocket_id property does exist in the rocketObject. Any idea what I could be doing wrong here? appreciate your help
@Johnny_1305K5 жыл бұрын
its worth noting that it only happens if I set the launch object to a state. If I assign it to a variable, I can access all the properties....
@bawad5 жыл бұрын
where are you putting the console.log? setState is async, so it won't take effect right away
@Johnny_1305K5 жыл бұрын
@@bawad import React, { Component } from "react"; import { Link } from "react-router-dom"; class Launch extends Component { constructor(props) { super(props); this.state = { loading: true, launch: {} }; } componentDidMount() { let flight_number = this.props.match.params.flight_number; flight_number = parseInt(flight_number); const url = `api.spacexdata.com/v3/launches/${flight_number}`; fetch(url) .then(res => res.json()) .then(launch => { this.setState({ launch: launch }); }); } render() { console.log(this.state.launch.rocket); ......................... ......................... } } This is my code, The funny thing is, is that I do get the rocket object with all its data, but when i do console.log(this.state.launch.rocket.rocket_id); It throws an error... I have tried async await and tried .then() From the promise I can log rocket.rocket_id, but not from the state..... Hopefully its a minor ting you are able to see right away....
@bawad5 жыл бұрын
What does console.log(this.state.launch.rocket) print? What is the error you get?
@iurii77526 жыл бұрын
Thank you for the inspiration, great job.
@sathvikvutukuri91794 жыл бұрын
Neat explanation..................
@antoniodungao4 жыл бұрын
Thank you. This helped me.
@Jasond29223 Жыл бұрын
what if we need to fetch the url based on the props that we get?
@alonelyproducer6633 жыл бұрын
Is there a way to display many persons?
@derrickwilliam10095 жыл бұрын
Very much helpful , Thanks a lot
@dhanukalakshan15535 жыл бұрын
Thnks bro you are a lifesaver❤
@iissy853 жыл бұрын
타자가 엄청 빠르시네요 ! 👍
@kevinmesto6082 жыл бұрын
Hey quick question for anyone who can answer, I've been seeing cors being used, something like this works fine so y would cors be needed?
@KearlHat3 жыл бұрын
How can you loop through to display an entire list?
@ashwinmukati52295 жыл бұрын
Why did you use componentDidMount instead of componentWillMount?
@bawad5 жыл бұрын
componentWillMount is being deprecated
@souravraodora66713 жыл бұрын
Where did results cane from?
@abishekh074 жыл бұрын
Thank you, Ben. I am trying to fetch data from multiple endpoints of an API for my COVID-19 stats app. I am making use of Promise.all to achieve this. But the issue here is that, every 1 out of 10 times I get a list of "undefined" values loading on the screen. Can you help me out with this!?
@vaclemor1024 жыл бұрын
Did you find a solution to this ?
@realprogger4 жыл бұрын
is it standard theme in vscode?
@faizannaseem70955 жыл бұрын
is it necessary to create database like phpmysql or mongodb to create fetch the data and then create api or can we fetch data directly from an API of JSON?
@bawad5 жыл бұрын
What do you mean
@aniket62575 жыл бұрын
Hi, It was a great help. I have a question How to add additional parameters to the fetch? (lets say the api allowed a parameter like name of a person, how to send a that parameter using fetch?) thanks