Fetch Data from API in React JS | Learn ReactJS

Fetch Data from API in React JS | Learn ReactJS

Dave Gray

2 года назад

38,035 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Vidit Goel
Vidit Goel - 04.10.2023 09:34

Hi, I noticed in this tutorial if we get an error in the fetch request after the list of items is loaded successfully initially our footer shows the number of list items from the items state as it is populated from the earlier successful fetch request so a simple fix that I did for this is that whenever we catch an error and set fetchError in the catch statement, I set state of items to an empty array setItems([ ]) so now if there's any error in the fetch request our footer element does not show the count of elements in it.

Ответить
Mose Gámez
Mose Gámez - 05.06.2023 01:21

Amaizing tutorial how to handle erros in useEffect😊

Ответить
Harag
Harag - 28.04.2023 17:35

Great video, thanks for this. Q) Do you later on go into moving the fetch items into a separate module - A data access layer so to speak? as you might want to call the fetchItems from several different components if it was a larger app, and also make the isLoading / fetchError more generic. All great for a small app like this.

Ответить
Bayan Salem
Bayan Salem - 27.04.2023 08:34

thanks Dave for this amazing tutorial, just a question is there a difference between new bash and new power shell terminal for this tutorial

Ответить
Shital Adkar
Shital Adkar - 06.03.2023 09:46

Hey Dave , I am from India . I have learned a lot from your channel and I always follow your methods to solve my problems, really you are great. Thank you very much .

Ответить
trinadh Kamma
trinadh Kamma - 28.01.2023 16:11

Instead of (async () => await fetchItems())();
can we directly call the function as fetchItems() ??
If so, then what is the difference between above two invoking methods.
Can you please explain.

Ответить
Deepak Singh
Deepak Singh - 07.01.2023 05:56

Superb Dev you are doing a great job Love from India ❤

Ответить
Root Media ሩት ሚዲያ
Root Media ሩት ሚዲያ - 28.12.2022 11:31

Hey Dave, Please help me @ how to fetch data from Elasticssearch and display it on React table. I have already Created React Table, and I have data on Elasticsearch. but I don't know how to call API on React

Ответить
Abdulazeez
Abdulazeez - 20.11.2022 13:02

It's really unfortunate that I discovered your channel just recently. I have been following a 40-hour React course on Udemy, your content is vastly superior than that course. I really like how you teach real life scenarios rather than just writing the bare minimum code.
Really appreciate all the efforts 👍

Ответить
Mohammadmahdi Alvansaz
Mohammadmahdi Alvansaz - 17.11.2022 18:36

great. thanks

Ответить
skill krio
skill krio - 17.11.2022 09:57

Dave in a rush of finding jobs . After completing react can i start learning node directly without learning redux. I had planned to learn it later. Does your node series uses redux anywhere?

Ответить
Psyfer Inc.
Psyfer Inc. - 02.11.2022 12:01

react made simple.

Ответить
Kiran Rai
Kiran Rai - 21.10.2022 18:36

Hello Dave, I am really learning alot from your playlist, but now I am stuck because of an error, in the useEffect hook when I try to update the setItem(listItem) , the items is not getting updated as a result I am not able to use any array functions and the browser is showing nothing, can you help me on this.

Ответить
Paresh B. Patel
Paresh B. Patel - 19.10.2022 14:37

A very thorough illustration of the use of the fetch API in react. Thanks, Dave

{2022-10-19}

Ответить
Hydro Help
Hydro Help - 12.09.2022 12:15

Top

Ответить
Rahmat Yousefi
Rahmat Yousefi - 19.08.2022 12:55

Thank You

Ответить
abdallah Azouz
abdallah Azouz - 12.08.2022 18:21

everyday I gain more experience by virtue of you , great thanks.

Ответить
Jiwei He
Jiwei He - 19.05.2022 07:14

Somehow useEffect({}, []) with an empty array was always runs twice when I reload the page. Only fixed this after removing the react strict mode..

Ответить
A Ono
A Ono - 14.04.2022 06:48

great video Dave. Thank you. I do get a CORS error. my backend is running on 5000 and the frontend on 3000. I can see you are on 3500 and 3000 respectively with no issue?

Ответить
a2222
a2222 - 30.03.2022 21:28

I guess, instead of using (async () => await fetchItems())() in setTimeOut, I can simply use fetchItems(). Is it right? setTimeout(() => {
fetchItems()
}, 2000)

Ответить
Vikas Chauhan
Vikas Chauhan - 11.11.2021 06:39

Excellent tutorial, please make a series of hook

Ответить
Hardwired
Hardwired - 03.08.2021 20:02

thank you sir

Ответить
ballon ura
ballon ura - 15.07.2021 13:59

How many episodes remain for the series ? :)

Ответить
Ahmad Murey
Ahmad Murey - 14.07.2021 23:40

I always wondered why alt-z is used for text wrapping! just figured out that the z shape looks the perfect symbol for wrapping :)

I would rather use chrome dev tool/Network/Throttling dropdown list to simulate slow connection because I know I'm going to forget to remove the setTimeout() from the original code,

Thanks Dave, I really enjoyed it,

Ответить