Тёмный

React Query Tutorial for Beginners vs Redux, Axios with CRUD Example 

Dave Gray
Подписаться 342 тыс.
Просмотров 89 тыс.
50% 1

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

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 180   
@VernonSwanepoel
@VernonSwanepoel 2 года назад
Brilliant. I've been on a project at work, in a fairly large codebase using react query already, and I'm still learning react itself, so there has been a lot to get my head around. This helped me a lot!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it was helpful! 💯
@hamzahahmad1670
@hamzahahmad1670 2 года назад
Absolutely underrated gem of a channel. This was such a brief yet thorough
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Hamzah!
@raffaelenicosia9335
@raffaelenicosia9335 2 года назад
Dave, you're definetly raising the bar!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Raffaele!
@mrbilchalan
@mrbilchalan 2 года назад
Hello Dave, I have watched almost all of your video tutorials. If you have some time, I am expecting a socket io And a sequalize tutorial from you. Please carry on. Thank you.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome and thank you for the requests! 🙏💯
@oortcloud210
@oortcloud210 Год назад
What a fantastic video. Everything explained so concisely and clearly. Thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're very welcome!
@surajjha5623
@surajjha5623 2 года назад
Just curious, is there any to-do for making videos about nextjs in your to-do list.😅
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
😂 later this year is the plan. MERN and Typescript had more votes and will come first 🚀
@codernerd7076
@codernerd7076 2 года назад
@@DaveGrayTeachesCode you can do MERN with Next.js...
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
@@codernerd7076 yes, but I always like to provide a foundational tutorial series first. That lets me refer back to it when answering questions.
@codernerd7076
@codernerd7076 2 года назад
@@DaveGrayTeachesCode It will work for the best same, As you may know, Next.js will make some major changes in their routing/layout system according to their latest blog posts, so the tutorials would be kinda outdated with the new version finally comes out. 😀
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
@@codernerd7076 Right! Technology keeps moving 🚀
@frankli7035
@frankli7035 2 года назад
really love all your videos,just one request could you please write in typescript rather than JS……that will be more helpful
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
I do plan to do a TypeScript series this year. I'm for beginners first, and they need to learn before moving to TS, too. You'll see both with and without here in the future 💯
@frankli7035
@frankli7035 2 года назад
@@DaveGrayTeachesCode that's amazing,that's for your time
@mhdfirassbarakat6587
@mhdfirassbarakat6587 Год назад
"let me know what you like in the comments" well ...... I like your videos so please for the humanity future keep going making this great content
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you, I will! 💯🚀
@mdameer0732
@mdameer0732 Год назад
so the content variable was not a state variable and yet the changes were reflected like it was a state variable? how
@mohammadawais1566
@mohammadawais1566 2 года назад
Dave your way of teaching is just awesome♥️ You and john smilga are best instructors for web development
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you for the kind words, Mohammad! 🙏 It's an honor to be mentioned with John 💯
@farhanizzaz5283
@farhanizzaz5283 Год назад
hello, may i know why u used the select meanwhile the docs said that the third parameter is for the cache time? thank you
@jordanryanethanowona2974
@jordanryanethanowona2974 Год назад
I absolutely love your channel. Of course i just subscribed lol. I have a question please. Do you have a video with Reactquery with jwt refresh tokens? and rbacs? basically with the middleware ? thanx a lot for everything. you are the real MVP lol.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you! No I do not currently. You could take what is in my React Auth playlist and apply it with React Query though. I should cover this with RQ in the future.
@jordanryanethanowona2974
@jordanryanethanowona2974 Год назад
@@DaveGrayTeachesCode Thanx a lot
@sonamohialdin3376
@sonamohialdin3376 2 года назад
Awesome tutorial thank you, regarding your question, i prefer React Query more than Redux RTK Query
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thanks for the feedback, Sona!
@sonamohialdin3376
@sonamohialdin3376 2 года назад
@@DaveGrayTeachesCode You are welcome
@permanar_
@permanar_ 2 года назад
freaking awesome dude. cool! could you do another video with swr maybe with React/Next.js by any chance tho? really appreciate this hard work anyway 🎉🎉
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Looking forward to covering Next.js later this year! 🚀
@kishoreandra
@kishoreandra 2 года назад
super helpful video yet again Dave ... 💯
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad to hear it! 🙏
@kishoreandra
@kishoreandra 2 года назад
@@DaveGrayTeachesCode 🤩
@Un0Real333
@Un0Real333 2 года назад
What is your opinion on using Redux and Axios (instead of RTK) for a big project? I just love using axios.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You can use Axios with Async Thunks. I show that in my Redux course before moving on to RTK Query. That said, you can also use Axios with RTK Query although I did not demonstrate it. You can implement it as shown in the docs here: redux-toolkit.js.org/rtk-query/usage/customizing-queries#axios-basequery
@fares.abuali
@fares.abuali 2 года назад
Thanks! Mr. Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome Faris! 💯
@jatilyadav4000
@jatilyadav4000 Год назад
Amazing video as always
@laxmiprasanna4092
@laxmiprasanna4092 Год назад
Does components render or update if server state changes in React query ? I mean without maintaining additional client state.
@henriqueomena7686
@henriqueomena7686 2 года назад
you do amazing videos, but plz could you do then with typescript ? would be amazing if you can do it, the market almost always expect for typescript
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Henrique! 🙏 I want to provide both. I will make a TypeScript tutorial series that will allow me to refer beginners back to it when I do other tutorials with TS. I always want to keep things beginner friendly along the way. 🚀
@howiewang4238
@howiewang4238 Год назад
Thank you for making this tutorial.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're very welcome!
@Reebak018
@Reebak018 Год назад
Thanks for this video. Also is this the same as TanStack Query ?; as far i know should be the same, the only difference is TanStack is avaiable for other frameworks.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Yes, it was previously called React Query. The overall concept is the same but there may have been a few updates since I made this video.
@brayandvelasquez2256
@brayandvelasquez2256 Год назад
I dont understand why when I am using React Query in Observers I get 26 or 29 in it. You can say why?
@portiseremacunix
@portiseremacunix 2 года назад
thanks for the tutorial again! do you have any plans for projects?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Yes, a MERN project later this summer. 🚀
@JagdishChoudhary
@JagdishChoudhary Год назад
In one of the large-scale projects, I am planning to use Redux-Toolkit for "client state" management, as I have so many modules and features such as Search, Advance Filter, infinite scrolling etc. So that I can store the state in the Redux toolkit using store and slices. Now I love React-Query because of "useInfiniteQuery", but I don't want to increase the bundle size as well by installing another library. One of the use case: When I get the list of data from the server, I want to cache the data, and if the user search or filter the data, I want to store the "searchText" and "FilterData" in the state, so when user navigate between pages and come back to the listing page, I can simply provide the already filtered data, that will sure improve the UX. So is it a good idea to stick with RTK Query as it is available inside the Redux-toolkit package and be in the same eco-system?
@chrisstucker1813
@chrisstucker1813 11 месяцев назад
If you're using Redux Toolkit I would probably just stick with RTK Query since it is built on top of Redux Toolkit and Redux Toolkit is built on top of Redux. It's like an all-in-one package to take care of both server and client side state. Plus you can pass in your RTK query reducers into your general Redux store along with the reducers for your client side stuff. So you can create one Redux store to hold both of your client and server side states. A more lightweight solution could be Zustand for client side state and React Query for server side state. It tends to keep things more simple and less convoluted than Redux.
@JagdishChoudhary
@JagdishChoudhary 11 месяцев назад
@@chrisstucker1813 Thanks for the response. Staying in the ecosystem would make more sense.
@alexshepel9387
@alexshepel9387 2 года назад
Awesome tutorial, thx!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad it was helpful!
@shnam928
@shnam928 2 года назад
Thanks a lot. Can we use useQuery for GET and for post, put and delete we use useMutation?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Yes, that is the idea! 💯
@ashharkausar413
@ashharkausar413 Год назад
In your opinion what is best for a react store? An example is a store containing the following: JWT access token, refresh token, name, credit card token etc. I have feeling you will say RTK but do you think RQ is good also?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Good question - and definitely just an opinion as there is no right or wrong here. Whatever you like and are most comfortable with will work. Redux & RTK Query are usually for more enterprise (large) apps. I would reach for React Query or similar in most small to medium projects, but there are some considerations. React Query works with caches. If you need some local state in addition, you could use the built-in Context API whereas RTK Query can just use Redux for state.
@ashharkausar413
@ashharkausar413 Год назад
@@DaveGrayTeachesCode cool ty
@shubhammishra1136
@shubhammishra1136 2 года назад
Nice video. One question though... What do you think of redux-saga for doing asynchronous task. I have seen that it still has over a million downloads on npm. So, what would be good of big projects ? Is it saga or rtk-query?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Great question! I should do a comparison 💯 After completing my Redux series, I wanted to do a few other topics, but I'll get back to it. 🚀
@none0n
@none0n Год назад
@@DaveGrayTeachesCode is this out?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
@@none0n I did not do this yet. So many topics to cover! 😀My channel is searchable from the channel homepage.
@none0n
@none0n Год назад
@@DaveGrayTeachesCode fingers crossed. I’m trying to design a Frontend style that’s reusable. This video helped me understand react query
@dharmeshgohil9375
@dharmeshgohil9375 2 года назад
i have question for can you tell something when will MERN project will come ? and which type of that project like ecommerce or blog website ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
MERN project later this summer. Not a blog but something based on examples where I can highlight what is needed.
@hypermeero4782
@hypermeero4782 2 года назад
man you're just so amazing
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you! 🙏
@danieljing9319
@danieljing9319 2 года назад
nice content, can we have a interval fetch with react-query?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Daniel 🙏 I think you may be referring to auto-refetching: react-query.tanstack.com/examples/auto-refetching
@codernerd7076
@codernerd7076 2 года назад
Redux is created by an team, and does fix two React app problems, while Redux Query is an one dev show, if something happened to this dev or maybe one day when he lost interest the package is doomed. Next to that unlike Redux your api code is all over the place...
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Good points! Yes, React Query offers more flexibility (less opinionated) but that does put some code a bit more "all over the place" as you say. I like using Axios with it, but I really like the more opinionated organization of RTK Query. I'll likely use both depending on the project. Enterprise/production for work will definitely be modern Redux and RTK Query.
@ahamisi
@ahamisi 2 года назад
Yes, Next Js + Typescript 🥲
@ThanHtutZaw3
@ThanHtutZaw3 2 года назад
do I need backend to use react-query-firebase
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
I think you need to be using Firebase which would be your backend - or at least your database. You can learn more about react-query-firebase here: react-query-firebase.invertase.dev/
@ThanHtutZaw3
@ThanHtutZaw3 2 года назад
@@DaveGrayTeachesCode I make Todo app with only React and Firestore onSnapshot. I have getting data delay about 1.3 second
@ProjectNation99
@ProjectNation99 Год назад
i didin't understand how did you increment the id without adding it to the todo : addTodoMutation.mutate({ userId: 1, title: newTodo, completed: false })
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
The REST API (backend) does that.
@ProjectNation99
@ProjectNation99 Год назад
@@DaveGrayTeachesCode thanks!
@SG48907
@SG48907 Год назад
Damn, it's still too slow at 1.5x speed 🤦‍♂
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
I have also been asked to slow down. Summary: I will never please everyone as each person has their own preferences.
@eazye7059
@eazye7059 2 года назад
Much simpler than RTK Query! Thanks
@MarlonEnglemam
@MarlonEnglemam 4 месяца назад
Do you think it’s ok to use react query to fetch data from the backend services and at the same time use redux toolkit to persiste some info that comes from those requests?! Let’s say I want to save user info so that it can be seen from different screens. I’m not sure about how to go with that, it feels “wrong”, at the same time I don’t like RTK Query very much since it’s more opinionated
@AnnieTaylorChen
@AnnieTaylorChen Год назад
I was going to ask you the "fetch" vs. "axios", is it still relevant today to use "axios"? I saw you are using it in React tutorial. Lately I've been considering React Query and will definitely check out this video too!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Yes, you can use Axios. You can even use Axios with React Query! I hope the video helps!
@vladyslavdremliuha6147
@vladyslavdremliuha6147 6 месяцев назад
Hi, Dave! Your video is super existing to watch and teach myself a little bit but my sort function is now working (todo items go to the very bottom of list). Don't have any clue why it is working that way.. Even despite taking and pasting your code from the git hub source.
@ramusubbu3778
@ramusubbu3778 2 года назад
Videos like this will be interesting!! Concentrating on one task! And explaining different methods by which we can achieve the task!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Glad you like it! 💯
@cortex3657
@cortex3657 Год назад
While mutating does all todos re render?????
@AkshayKumar-kz6zh
@AkshayKumar-kz6zh 2 года назад
I was going through the documentation and sir you dropped a video. Thank you very much for such great tutorials! Also 69th like. Nice
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Akshay! 🙏 Good timing!
@manoj03h
@manoj03h Год назад
I too like RTK Query with Redux
@anshvashisht8519
@anshvashisht8519 Год назад
22:23 for update todo logic
@abdomahmoud8769
@abdomahmoud8769 2 года назад
Hi Dave! Can you make an accessibility course so our websites become more useable.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thanks for asking! This is an item on my ToDo list! It is something I definitely want to create. 🚀
@thecutedreamkostasp.4449
@thecutedreamkostasp.4449 2 года назад
Another excellent tutorial! You sir and net ninja are the best out there!! Ty!!!!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Wow, thanks! 🙏 You have put me in great company, and I sincerely appreciate the kind words!! 💯
@shakhawathhossainshatu1487
@shakhawathhossainshatu1487 Год назад
Thank you so much for videos
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're welcome!
@TradingBloke
@TradingBloke 8 месяцев назад
do you think for the job of junior react developer react query is needed?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 8 месяцев назад
It is good to know. Specifically it will depend on the job.
@sherinc7998
@sherinc7998 Год назад
Is it possible to use react query in project redux toolkit is used for state managmemt ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You mean instead of Redux Toolkit? Yes. If you mean at the same time - I don't think I would use them together.
@josephtan6018
@josephtan6018 2 года назад
Hi Dave. Thank you for this video. So you prefer redux and rtk query. Is it redux toolkit and rtk query? If so, do you have a repo project for that? Thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Based on project size and needs, I would choose. I do have a full modern Redux course with Redux Toolkit and RTK Query: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-NqzdVN2tyvQ.html
@proletar3799
@proletar3799 2 года назад
in this video, he was showed to us to use react-query and react-query is different package with rtk query..rtk-query is addon with in rtk package. im prefer to use rtk-query instead of react-query. for me it seems a bit similiar with react-query. repo rtk-query: shorturl.at/jsvG7
@saurabhpathak6177
@saurabhpathak6177 Год назад
I am getting an network error with checkbox element and it is not getting checked on unchecked.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You can compare to my source code to find the difference.
@MusicMan121
@MusicMan121 Год назад
9:50 I did this like this at work and I was called out because they say you're not supposed to have so many similar CRUD methods.
@Abbos_700
@Abbos_700 7 месяцев назад
Thank you very much for your lessons Dave. You are helping lots of people around the world. Could you please update this course to tanstackQuery v5
@DaveGrayTeachesCode
@DaveGrayTeachesCode 7 месяцев назад
Great request! I need to do this.
@Abbos_700
@Abbos_700 7 месяцев назад
@@DaveGrayTeachesCode Great tysm, then I look forward to it.
@abuhossain4274
@abuhossain4274 Год назад
as your lesson its clear that rtk and react query use case depends on the size of project.
@ms77grz
@ms77grz 2 года назад
Thx! I use RQ and Recoil at the moment.
@abba3261
@abba3261 2 года назад
i remove redux from my life . react query is so useful
@dharmeshgohil9375
@dharmeshgohil9375 2 года назад
awesome tutorial
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thank you, Dharmesh! 💯
@rakhisingh9797
@rakhisingh9797 2 года назад
Bro if you have one choice which one you choose rtk query or react query?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Hi Rakhi, as I mentioned in the video, it is really situational but I lean towards RTK Query. Redux is a marketable skill that could help with jobs and RTK Query is part of modern Redux. 🚀
@jniyaz
@jniyaz 2 года назад
on rtk query vs react query.. seems react query is much simpler to implement.. since rtk query is supported by the same redux team.. hav some advantage.. What do you think Dave?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Yes, I do agree that React Query is an easier implementation. If you do not have a large project - specifically if you do not need global state management - React Query is a good choice. RTK Query integrates with Redux and is great when you do need global state management.
@jniyaz
@jniyaz 2 года назад
fully agree.. ✌
@AmirulIslam-uj3yz
@AmirulIslam-uj3yz 11 месяцев назад
Thank you Mr Dave
@samiullahsheikh5015
@samiullahsheikh5015 2 года назад
Does it make sense to be ReactJS developer but not to be css expert? I mean css it's self is way more complex with responsiveness and pixel perfection. While css expert struggling in integration of payment gateways, and other 3rd party services etc a ReactJS developer could be much more comfortable in those things
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You don't have to be a CSS expert. It does help to know the fundamentals. Likewise, a CSS expert does not need to be a JS expert, but it also helps a CSS expert to know JS fundamentals.
@brayandvelasquez2256
@brayandvelasquez2256 2 года назад
Great video! quick question, how React Query says, do u even use Redux anymore? Watching this video I can say it is better and more clean code than using Redux, Thunks and things like that. What do u think? I just started a big Proyect and we decided to use React Query for all our work, but that, more understanding using React Query than others libraries
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
React Query is a great choice for many projects! I like it! 💯
@minijavi19
@minijavi19 Год назад
Great work! Loved your video. Just one thing I'm not quite understanding... where are we mapping our ./data/db.json to the Todo api? how does the app knows?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Going by memory here - If I used json-server as a dev database, when you launch json-server, it tells you the address and port number it is available on.
@sinhuu.s2
@sinhuu.s2 2 года назад
congratulations !! very good. so that I use an add function on another page, for example, just import TodoList and use the addTodoMutation function?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
TodoList is a component in this video. If using addTodoMutation, you also need to import the addTodo function.
@abhishekbohora9691
@abhishekbohora9691 2 года назад
Why the github repository linked below doesn't have any dependency in package.json in both intro and starter.. there is only css code..?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
The starter code does not have the dependencies because I walk you through adding them in the tutorial. However, if you look at the completed project, all of the dependencies are already listed in the package.json. Clone the repository and then run npm update to install all of the dependencies.
@MrQVeeBoo
@MrQVeeBoo Год назад
thx. straight to the point and this one is very easy to understand.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Welcome!
@mohammadmahdialvansaz8001
@mohammadmahdialvansaz8001 Год назад
Thank you.
@daniel_narh
@daniel_narh Год назад
Please what programming font are you using? The one in this video seems pretty decent. Taking this as a crash course
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
I show my font choices in this short: ru-vid.comf1HVI5slxms
@elinordeniz
@elinordeniz Год назад
Hi Dave, We would like intermediate to advanced react or mern stack projects. That would be so useful for us after all these great tutorials. Thank you for all.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
You're welcome! Have you tried my MERN Stack Course? It's a big project: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-CvCiNeLnZ00.html
@acehanks
@acehanks 2 года назад
Something really small, no need to await from the return statement.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Good catch! So for anyone reading - outside of a try/catch block "return await" is redundant. It doesn't hurt anything but is unnecessary. I have "return await" on the addTodo, updateTodo, and deleteTodo. The await can be removed there. Do not remove it from getTodos though! Good article on this from Jake Archibald here: jakearchibald.com/2017/await-vs-return-vs-return-await/
@handikadwi7559
@handikadwi7559 Год назад
Would you update this course to use React Query v4?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
I can do another video. I cannot update a video that is already published. Overall, this intro tutorial just covers the basics, and I don't think much has changed for these.
@ssj1260
@ssj1260 Год назад
Thanks for the video, great intro to react-query. Quick question if you don't mind. Why do you use a variable with JSX instead of a Component? (e.g. newItemSection), is there any benefits to this or is it personal preference?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Good question! It is something I started doing awhile back. I like defining everything including what I am going to return, but there is no requirement to do so.
@IzharJumadi
@IzharJumadi Год назад
Great stuff! Thanks so much for sharing :)
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
@mohamedyoussef8835
@mohamedyoussef8835 Год назад
Awesome video as always ++++++++++++++++ 🙂
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you!
@햄버거맨-g8c
@햄버거맨-g8c 2 года назад
Thanks for your tutorial.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome! 💯
@benarbiamohamedtaher546
@benarbiamohamedtaher546 2 года назад
Excellent tutorial,thank you gray
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Very welcome!
@Rafiki041087
@Rafiki041087 Год назад
Really good content, I'm new to react and these videos are a great way to learn.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad to hear it!
@jaikrishna3586
@jaikrishna3586 Год назад
I learned a lot today.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad to hear that!
@hungnguyencanh5089
@hungnguyencanh5089 2 года назад
Thank you so much!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
You're welcome! 💯
@gunasekarant6498
@gunasekarant6498 2 года назад
Awesome one 🙂
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Thanks 💯
@thattablebloke
@thattablebloke 2 года назад
Hey Dave, another great vid, thank you. I'm using React Query for a project and have the basic fetching and mutations going - one thing I'm wondering if it's possible to do is when a component/page loads, check react-query data I have in cache already from other pages for a matching id to save having to fetch this item again. If it's there, just use that data. If not, fetch the data. Is this possible, or way too much to be doing? I've been trying to figure out for ages now but can't quite figure it out..
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
React Query accepts a function where you can select the data you need. Let's say you query users data for a users list and then go to an individual users page. You can pass a select function into the same query on the individual user page. It should used the cached data instead of making a new request - unless the cache has expired. You can control this expiry with more detail by following the example under "Conditional Initial Data from Cache" here: tanstack.com/query/v4/docs/guides/initial-query-data
@thattablebloke
@thattablebloke 2 года назад
@@DaveGrayTeachesCode Thanks, I'll dig into this! My possible issue is having a separate cache for the individual items and then all items. I'd like to check [all-items] cache for an id that matches one passed as a param to the indiv item page, if there, populate the [indiv-item] cache with this data (but if the cache doesn't exist yet.. ??) A lot to figure out, but I'll start with that link and hopefully can get there.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
@@thattablebloke look at "select-partial-subscriptions" : tkdodo.eu/blog/react-query-data-transformations
@thattablebloke
@thattablebloke 2 года назад
@@DaveGrayTeachesCode Great, thanks so much, will have a good look.
@viktorkasap
@viktorkasap Год назад
Дэйв, спасибо, отличный обзор библиотеки Но хотелось бы увидеть весь потенциал, напримере какого нибудь список дел, чтобы можно было отметить готово дело или нет, с отдельной страницей каждого дела, с пагинацией и чтобы не было перерендеров (наверное это ключевое) =)
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Thank you! Yes, you could go deeper here. Create a component for each Todo and use React.memo on those components to prevent unnecessary re-renders.
@viktorkasap
@viktorkasap Год назад
​@@DaveGrayTeachesCode React.memo - Is there only one way to solve this problem?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
@@viktorkasap no but it's usually the solution I prefer.
@viktorkasap
@viktorkasap Год назад
​@@DaveGrayTeachesCode Thank you very much 🙏
@annusingh4694
@annusingh4694 2 года назад
Hi Dave, I absolutely love your tutorials. Can we know if you'll be making any fullstack (Typescript) tutorials as well ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
Eventually, yes. I want to do a TypeScript series first. That will allow me to refer beginners back to it for fundamentals & questions. 🚀
@nawazishali274
@nawazishali274 2 года назад
Ohh yes just awesome plz perform CRUD with react query in easy way..
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 года назад
That is what this video is about. React Query with easy CRUD examples.
@Pareshbpatel
@Pareshbpatel Год назад
Excellent Tutorial on React-Query. Thanks, Dave {2022-10-13}, {2022-11-10}, {2022-11-17}
@DaveGrayTeachesCode
@DaveGrayTeachesCode Год назад
Glad it was helpful!
Далее
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
Просмотров 1,1 млн
Combining Zustand with React Query
20:24
Просмотров 19 тыс.
The Story of React Query
8:55
Просмотров 106 тыс.
Redux Toolkit Query vs React Query
22:12
Просмотров 107 тыс.
I tried 8 different Postgres ORMs
9:46
Просмотров 413 тыс.
State Managers Are Making Your Code Worse In React
13:33
React Query. Быстрый старт
30:09
Просмотров 50 тыс.
Master React JS in easy way
12:18
Просмотров 94 тыс.
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
Просмотров 1,1 млн