How To Make API Call In React using useEffect() Hook With Fetch API and async / await

preview_player
Показать описание
(We're free online community, meet other makers!)

Keywords:
react useeffect to call api
how to get data from url in react js
Рекомендации по теме
Комментарии
Автор

watched videos that were hours long and this three minute video is what actually made everything click. Thank you.

AleySoundz
Автор

Thanks this is very useful, what can I do if I want the temperature to change when I click a button?

eddysantiagorhenalsperez
Автор

On line 12 at @2:50, why did you use ".then" on result.json() if you were already using async/await syntax for the fetch line above it? Can we not just use "const data = await result.json()" ?

vuestacks
Автор

Why don't we use fetch directly but we created a separate function?

kashmirtechtv
Автор

Why would you put your API key on the front-end!? Nobody builds API calls this way...

jackepner
Автор

as a guy who never worked with api and react. that code is discountingly hard to read.

spamcolector
Автор

Does this still work? Copied this line for line and get - cannot read properties of undefined (reading 'temp_f'). Seems like you need a special key (not the standard one.

AB-kqxm
join shbcf.ru