Okey this is exactly what I needed. Concise direct and straight to the point. Love it
@CodeWithRia Жыл бұрын
Thanks, I love this shorts you do where you explain key concept in JS or React simply for anyone to understand. They have been really helpful and understandable. Please keep doing them. Could you do some on using axios in react and also how to display data you fetch from an api on the browser. Thank You.
@CodeWithRia Жыл бұрын
Also fetching data from an API that doesn't have id or page param.
@richardbray Жыл бұрын
Sure thing, I'll add it to the list
@leader6422 Жыл бұрын
Don't forget the try ctach block
@richochet10 ай бұрын
Brilliant 👏🏼
@thecodebear Жыл бұрын
Nice video👍
@conradhansen-quartey50535 ай бұрын
Explained well - thank you!
@richardbray4 ай бұрын
You're welcome!
@akashofficial5869 Жыл бұрын
Gud🎉
@No_one123518 ай бұрын
Awesome information!
@Atomistry10 ай бұрын
This is really helpful but how do you display the data that has been returned by the api?
@richardbray10 ай бұрын
Currently just logging it to the console but if you had a framework you could just display the data in a templating language
@SingularityFe7 ай бұрын
Yup, this is what I've started doing at work
@sxuwrr5 ай бұрын
Axios will help brother
@zahreddinesoualem3213 Жыл бұрын
Sir, I am golang developer, I dound myself forced to build a website with react and go, can you give quick tip how to access each element from json individually?
@richardbray Жыл бұрын
Hmmm, I'm not sure I understand. Why would you want to do that in the first place?
@zahreddinesoualem3213 Жыл бұрын
Long story, anyway thanks for your response I found my way to the what I was looking for.
@Omaxim1638 Жыл бұрын
Pls do for C++
@guywhoplayz60426 ай бұрын
Or just chain it with thens and a catch
@WidowSoundsNoCopyright Жыл бұрын
how do i access a random 3rd party api? For me, nothing is happening when I try to fetch from it even though I did what you did.
@richardbray Жыл бұрын
What error are you getting?
@WidowSoundsNoCopyright Жыл бұрын
@@richardbray im not getting any error. Its just either printing nothing to the console (even though I'm printing the data and) or it just says undefined. Im using a pretty unpopular API so I don't know if that's the reason or not. But it should work.
@ahmedahmedx960010 ай бұрын
But what if i dont want js to run the next line before getting data first ? Is there a way to block js in fetch line
@richardbray10 ай бұрын
You'd have to put the code you want to run next in the promise resolve section, so the then method or create a promise with the code and await it, if that makes sense. Happy to make a video if it doesn't.
@ahmedahmedx960010 ай бұрын
@richardbray yes I got it but not 100% 😅, so if you can do a video about that topic I'll be grateful 💙
@rameshbabu-r6g Жыл бұрын
bro if we want to print that data into document ? then how can we use ??
@richardbray Жыл бұрын
You can create an element with JavaScript and use innerHTML or innerText to add data to it. Or you could use a framework like React
@kseperepere505 Жыл бұрын
How different is it from getting data from maybe a Github repo
@richardbray Жыл бұрын
It's not common for data to be kept in a github repo. If you wanted to get data from the ChatGPT api, you would need an api key which isn't available via github
@factcinemaaa9 ай бұрын
From India
@33v4. Жыл бұрын
when/how do you that you can fetch without using async await?