Тёмный

4 Ways To Fetch Data in React 

PedroTech
Подписаться 214 тыс.
Просмотров 57 тыс.
50% 1

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 93   
@nomapos
@nomapos 2 года назад
Hello, please we need some react native content .... Even if it's only notes ... Please share ...🙌🙌
@behold_a_son
@behold_a_son 2 года назад
2:49 The result is not JSON, here's a quote from mdn on Response.json(): "Note that despite the method being named json(), the result is not JSON but is instead the result of taking JSON as input and parsing it to produce a JavaScript object." So correct me if I am wrong: the result obtained after the fetch promise has fulfilled, is already in JSON. When you do res.json(), it returns another promise that converts JSON into a JavaScript Object, so you can for example use the dot operator on the data when the returned promise of res.json() is fulfilled. We all are learning! Don't let a mistake like that haunt you Pedro! You've been a great help to me! :)
@PedroTechnologies
@PedroTechnologies 2 года назад
Yes! The way i said it came out wrong, but you are right 🙂 The function parses a json into a js object.
@diegounanue
@diegounanue 2 года назад
More videos about how to structure a large project with react query :)
@PedroTechnologies
@PedroTechnologies 2 года назад
Will do!
@madalinavasile5930
@madalinavasile5930 2 года назад
Hi! I just want to say a big thank you! For my graduation project/bachelor thesis I decided to make an app using React. It was a totally new technology for me and the first app I ever made. Finding your tutorials and videos was been really helpful, they're really easy to follow and your explications and examples are great! I'll have to make sure to go back to every video I watched and leave a like. Good job and hopefully more people will find your channel!
@PedroTechnologies
@PedroTechnologies 2 года назад
This makes me really happy! Im glad you were able to learn from my videos 🙂
@EduardKaresli
@EduardKaresli 2 года назад
There is also RTK Query, from Redux Toolkit.
@fandross_
@fandross_ 2 года назад
E ai mano, tu eh o melhor professor que eu ja tive, valeu ai!
@sudiptokumarmitra9845
@sudiptokumarmitra9845 2 года назад
Can you please make a project-based tutorial using the redux toolkit and react query and show how to create industry standard coding and folder structure??
@songokussj4cz
@songokussj4cz 2 года назад
+1 ! Show us something real, please. Best practices in your opinion.
@AM-nm6ts
@AM-nm6ts 2 года назад
please if it's possible, when u have time, ---> context api vs prop drilling thanks a lot
@universecode1101
@universecode1101 2 года назад
This is a very important step guys … good video Pedro 👏🏻
@ioana4011
@ioana4011 4 месяца назад
Thank you so much, Pedro, for the video. I have been watching many videos, but yours are by far more helpful. Would you be able to do a tutorial on Nivo charts API integration? This topic is poorly documented and it would help tremendously to have your guidance. I am pretty sure I am not the only one searching for it 😅. Many thanks 😊
@filipevalentegomes2383
@filipevalentegomes2383 2 года назад
I’m surprised you didn’t mention rtk query, that’s another one, lots of people love using. Still great video
@PedroTechnologies
@PedroTechnologies 2 года назад
Rtk query is good! I didn't mention because I don't use it that much (very few times) so I can't explain it to the best of my habilities
@rohan1765
@rohan1765 2 года назад
RTK query is so cool 🙂
@michealdalu8620
@michealdalu8620 2 года назад
This is gold .. thanks 🙌🏽👏🏾👏🏾👏🏾
@abdirahmann
@abdirahmann Год назад
am dead 29:29 "writting code that doesn't male sense"
@nazmulalam1982
@nazmulalam1982 Год назад
18 version is fast but 16 version too slow my office project running 16 version how to fast do it?
@_boza
@_boza 2 года назад
I heard and use some basics of React Query but you mentioned many things that I did not know and they are very useful! Thank you! :)
@mentoriii3475
@mentoriii3475 2 года назад
1:55 fetch api is a browser api, technically not built in into javascript but in the browser
@PedroTechnologies
@PedroTechnologies 2 года назад
Yes you are right! In the video I meant to say that u can use i without installing any library (such as axios). I see how it sounds wrong now hahaha
@SahraClayton
@SahraClayton 2 года назад
React Query is by no means a state solution, also I like your videos but just get to the point, it took you over 4 minutes from the start of the React Query part to even get to the point of React Query
@PedroTechnologies
@PedroTechnologies 2 года назад
Couldn’t agree more!
@faisalamin001
@faisalamin001 2 года назад
Please also make video on testing i.e Jest etc Thanks
@PedroTechnologies
@PedroTechnologies 2 года назад
Just posted one a couple hours ago hahaha
@faisalamin001
@faisalamin001 2 года назад
@@PedroTechnologies wow, hahahah thanks bro ❤
@Pareshbpatel
@Pareshbpatel 2 года назад
Great Tutorial on four ways to fetch data in React. Thanks, Pedro {2022-06-14}, {2023-09-06}
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue 2 года назад
Thank you dude. Is the suspense new feature still experimental or can it be used in production for nextjs apps?
@PedroTechnologies
@PedroTechnologies 2 года назад
Its not experimental anymore, it came with react 18!
@patrickorji3616
@patrickorji3616 2 года назад
I don't have anything displaying on my browser when I use the Fetch API and Axios API. All my codes are correct just like that of Pedro's. I will appreciate a response
@Moon-li9ki
@Moon-li9ki 2 года назад
boa pedrão, teus videos sempre me ajuda demais! Nem sabia q vc era brasileiro, seu inglês é muito bom
@DeepLook1
@DeepLook1 2 года назад
Thank uuuuuuuu . And how many ways we have to insert record to database like mysql. Thank u again for this video
@atandauthman2126
@atandauthman2126 2 года назад
I can see you have the copilot extension, I'm sort of having issues getting my own to work I don't know what I'm doing wrong but it shows the icon as cancelled every time
@jackiedo7370
@jackiedo7370 2 года назад
just cmt to say thank you ❤
@pookiepats
@pookiepats Год назад
Thanks!
@PedroTechnologies
@PedroTechnologies Год назад
Thank you so much for the support!!
@WTFBRUTUS
@WTFBRUTUS 2 года назад
Just what I needed to know thanks!!
@manasahr478
@manasahr478 Год назад
Could you please help me how to fetch data from mssql database stored procedure to reactjs
@vnm_8945
@vnm_8945 2 года назад
love it!
@aghilannathan8169
@aghilannathan8169 2 года назад
Damn to Redux Toolkit Query.
@kabagambedaniel2468
@kabagambedaniel2468 2 года назад
nice one
@adarsh-chakraborty
@adarsh-chakraborty 2 года назад
I wish you showed stale option in react-Query. Anyways nice video!!
@stephengatonga844
@stephengatonga844 2 года назад
Hi, am using axios to fetch data but am getting this kind of error...... AxiosError: Network Error
@fullfungo
@fullfungo Год назад
There might be an error with your network.
@stephengatonga844
@stephengatonga844 Год назад
@@fullfungo I have come a long way😅, at that time such an error gave me headaches now am good at react.js and react native🤣 Thank you for the response anyway.
@icecream5335
@icecream5335 2 года назад
I want to fetch the data from the server which uses jwt auth. Please help me.
@renesalvacion6169
@renesalvacion6169 2 года назад
Do I need to fetch data in react, if I used nodejs for backend?
@adarsh-chakraborty
@adarsh-chakraborty 2 года назад
Yes frontend needs to do network requests to get data from backend. Doesn't matter if it's node server, python or java.
@PedroTechnologies
@PedroTechnologies 2 года назад
The frontend has to fetch the data from the backend in order to get the data.
@MyALPHAguy
@MyALPHAguy 2 года назад
ainda bem que vc não usou o typescript
@himanshugaikwad4998
@himanshugaikwad4998 2 года назад
Nice video like always. Thank you very much. Can u make a video on auto image slider in react js? i would love to learn that from u
@sujoykrhaldar
@sujoykrhaldar 2 года назад
hi Can you make a series on how to use swr client side fetching in nextjs and react query as well.
@Ellenox147
@Ellenox147 2 года назад
Great video thanks ! What's the theme plzzzzzzz ?
@Hacking-NASSA-with-HTML
@Hacking-NASSA-with-HTML Год назад
Thank you so much, sir 👍♥️🤝
@sohadmad1823
@sohadmad1823 Год назад
Thank you , very useful video ❤
@smartjefreycoca5425
@smartjefreycoca5425 2 года назад
Brother pedro can you make a tuotrial creating a User Management System using React Js and MUI
@user-uw1rh4dg1y
@user-uw1rh4dg1y 2 года назад
Questions can come in⬆️.
@sethheinzman5823
@sethheinzman5823 2 года назад
You can also use SWR config to set a fetcher and set the suspense for all of the useSWR so you can just include the url and nothing else. That’s how this book taught it but I kind of like having the option to change the fetcher.
@abulazaiemabas5070
@abulazaiemabas5070 2 года назад
Fetch api is built-in the browser not node
@tech3425
@tech3425 2 года назад
Cool vid. Would love to see something like using react query with firebase, if that's something you find interesting.
@user-uw1rh4dg1y
@user-uw1rh4dg1y 2 года назад
Questions can come in⬆️.
@licokr
@licokr 2 года назад
Thank you so much! Great!
@arsnakehert
@arsnakehert 2 года назад
Your channel is a treasure of knowledge, man
@shinobi_coder88
@shinobi_coder88 2 года назад
Hey Pedro, just wanna clarify that in React 18 anytime when there's sth to do with api we no longer need to use useEffect() right? Since React Query benefits our performance better. Honestly I've tried both Pagination and Infinite Scroll in React Query which are really good in React app. However, when I use React Query in NextJs that's where I feel it slows down the app performance a bit.
@PedroTechnologies
@PedroTechnologies 2 года назад
I mean, it depends on how your app is running. I usually use SWR when im working in a nextjs app and react query when I am not. But both should be good, try to optimize the way your are fetching ur data and see if it is react query that is really causing the issue. For example, are you paginating by fetching data incrementally?
@shinobi_coder88
@shinobi_coder88 2 года назад
@@PedroTechnologies what do you mean by incrementally? In my scenario, for example Rick and Morty API, when it comes to NextJs the only thing that React Query helps is prefetching data with SSR or SSG. But when clicking to the next new page (which is not the previous data yet) then it renders not as fast as React App. On the other hand, I have also tried to fetch Weather API with React Query in NextJs and it seems quite slow too compared to using only SSR to fetch the data from Weather API
@shinobi_coder88
@shinobi_coder88 2 года назад
@@PedroTechnologies I'm also curious what makes you choose SWR instead of React Query for NextJs App ?
@ramonarthur2729
@ramonarthur2729 2 года назад
@@shinobi_coder88 export const getStaticProps: GetStaticProps = async (context) => { const { slug } = context.params as IParams; const queryClient = new QueryClient(); await queryClient.prefetchQuery(['product', slug], () => fetchProduct(slug)); await queryClient.prefetchQuery('products', fetchProducts); return { props: { dehydratedState: dehydrate(queryClient), }, }; };
@ramonarthur2729
@ramonarthur2729 2 года назад
@@shinobi_coder88 export default function ProductDetails() { const router = useRouter(); const { slug } = router.query as IParams; const { data: product } = useQuery(['product', slug], () => fetchProduct(slug) ); const { data: products } = useQuery('products', fetchProducts); if (!product) return ; .....
@ts8960
@ts8960 2 года назад
async await is the best way.
@Lunolux
@Lunolux Год назад
great video, thx
@jorge.camargo
@jorge.camargo Год назад
Fantastic. Thank you!
@RicardoGuillen
@RicardoGuillen 2 года назад
You forgot RTK Query :/
@PedroTechnologies
@PedroTechnologies 2 года назад
RTK Query is interesting, but I don't use it a lot since I am not that fond about Redux
@RicardoGuillen
@RicardoGuillen 2 года назад
what do you recommend to use with Zustand? Zustand + React Query?
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue 2 года назад
@@RicardoGuillen if you know RTK, stick to that one and learn it well. Its great
@sonamohialdin3376
@sonamohialdin3376 2 года назад
Awesome tutorial
@mr-36
@mr-36 2 года назад
Fetch is not part of javascript. Fetch belongs to BOM(browser object model)
@nanimys
@nanimys 2 года назад
in turn, belongs to the javascript library!!
@PedroTechnologies
@PedroTechnologies 2 года назад
I meant that when you are using javascript, you don’t have to download any extra library to use the fetch api.
@mentoriii3475
@mentoriii3475 2 года назад
@@nanimys no sir, there is a reason it's called an api, we use it on javascript but it's not built in javascript
@mr-36
@mr-36 2 года назад
@@mentoriii3475 Exactly!
@varaprasad6531
@varaprasad6531 2 года назад
Thanks Pedro!
@aravindsanjeev4150
@aravindsanjeev4150 2 года назад
Who wants to steal his intro bgm?
@andreyokhrimenko2271
@andreyokhrimenko2271 2 года назад
const { isLoading, error, data, isFetching } = useQuery(["dog"], () => axios .get("random.dog/woof.json") .then((res) => res.data) ); This is right way
Далее
Вопрос Ребром - Серго
43:16
Просмотров 738 тыс.
How to FETCH data from an API using JavaScript ↩️
14:17
6 State Mistakes Every Junior React Developer Makes
15:53
Realtime Chat App in React Native and AWS (Backend) 🔴
3:29:01
How To Learn React In 2024 - React Roadmap
20:51
Просмотров 10 тыс.
Modern Data Fetching in React (Complete Guide)
16:41
Просмотров 49 тыс.
Вопрос Ребром - Серго
43:16
Просмотров 738 тыс.