React Query - Data Fetching Hooks

Поделиться
HTML-код
  • Опубликовано: 18 янв 2025

Комментарии • 87

  • @andyslezak3606
    @andyslezak3606 4 года назад +6

    Your videos are always super helpful and high quality, Leigh. Great content and learned a lot from you. Thanks for taking the time to make them!

    • @leighhalliday
      @leighhalliday  4 года назад +1

      Thanks so much for taking the time to say hello, Andy! I appreciate it :)

  • @alirasheedmd
    @alirasheedmd 3 года назад

    Love you man!!! since yesterday I watched so many tutorial on react query but none of them explained it this well. Subscribed.

    • @leighhalliday
      @leighhalliday  3 года назад

      Thank you! I appreciate the kind words!

  • @monfernape
    @monfernape 3 года назад +1

    Loved the explanation. Caching is the best thing RQ gives.

    • @leighhalliday
      @leighhalliday  3 года назад +1

      Thanks Usman! Yea man, RQ is awesome!

  • @marcosfsjunior
    @marcosfsjunior 3 года назад

    I always enjoy your videos! Thanks! The error is not set up because fetch does not throw by default, you have to check the response and throw an error with a message yourself.

  • @sogolnaseri1213
    @sogolnaseri1213 4 года назад +1

    Thank you so much Leigh, very well explained, it was the best video I've ever seen so far.

    • @leighhalliday
      @leighhalliday  4 года назад

      Thank you very much Sogol! Glad you enjoyed it :)

  • @Daniel-wx9wz
    @Daniel-wx9wz 4 года назад +3

    Thank you! Was actually just looking at this library the other day.

    • @leighhalliday
      @leighhalliday  4 года назад +1

      Nice! Did this video help at all, Daniel?

  • @realconect
    @realconect 4 года назад +2

    Thanks, very informative and straight to the point!

    • @leighhalliday
      @leighhalliday  4 года назад

      Thank you Alan! Glad you enjoyed the vid :)

  • @alburnto
    @alburnto 4 года назад +1

    Thank you! Needed an introduction to the library.

    • @leighhalliday
      @leighhalliday  4 года назад +1

      Sweet! It's an awesome library, and the creator Tanner Linsley is super on the ball and helpful.

  • @LauraBeatris
    @LauraBeatris 4 года назад +1

    Thanks Leigh, amazing content as always. Greetings from Brazil ❤️

  • @tpol45
    @tpol45 3 года назад

    Great video, well explained. Thank you!!

  • @76Freeman
    @76Freeman 4 года назад +1

    I love your content it's always so well explained.

  • @stavroskefaleas6320
    @stavroskefaleas6320 4 года назад +2

    Congratulations for this video using this promising library!
    Can I use it to replace the use of redux, reselect and redux-thunk in my project?
    The back-end I am using us firestore.
    Keep up the good work!

    • @leighhalliday
      @leighhalliday  4 года назад +2

      Hey Stavros! I've never used redux-thunk or reselect... so I'm not totally sure, but I think some of it depends where you want your data. This will give you your data right in the component, but without the ability to have it in your redux store to share to the rest of your global components. If you wanted to share the response from react-query, you'd probably want to look into creating your own context and provider.

  • @chany0033
    @chany0033 4 года назад

    Thanks Leigh! I ❤️ this resource! great video, keep going!

    • @leighhalliday
      @leighhalliday  4 года назад

      Thanks Chany!! Aiming for another one this week :)

  • @mamathadevarapalli
    @mamathadevarapalli 4 года назад

    Great video!! Replace {error} with {error.message} to show the error.

  • @SHELLAC85
    @SHELLAC85 4 года назад

    I like the look of this. Thanks for the demo :)

    • @leighhalliday
      @leighhalliday  4 года назад

      It's a really cool library!! I don't know which I prefer, `swr` or this one, both are pretty great and accomplish similar things!

  • @keepforever726
    @keepforever726 4 года назад +2

    Thank you for doing this. Been seeing a lot of chatter on dev twitter about this.
    One tiny request: Maybe set the css for the html background to be a charcole color and the text to be an off-white. So that way going from the code editor to the browser isn't blinding bright.
    #darkModeEverything

    • @leighhalliday
      @leighhalliday  4 года назад +3

      Hey Brian! Thanks for the feedback. Just for you, I promise I'll do the next video with a dark theme ;)

  • @berlino5563
    @berlino5563 4 года назад

    always cool videos, man! my congratulations! ;)

  • @dijup
    @dijup 2 года назад

    I am using react query to fetch data, I want to combine it will some kind of offline storage. What will be the best way to do it? Should I use asyncstorage or SQLite and how can I combine it for better control on data.

  • @benwasilewski
    @benwasilewski 4 года назад +2

    Shouldn't the react-query-devtools dependency be under "DevDependencies"?

  • @mamunmokni8699
    @mamunmokni8699 4 года назад +1

    Hi Leigh, thx for this amazing video, could you just please show an example where you implement it along with useEffect

    • @leighhalliday
      @leighhalliday  4 года назад +1

      Hey Mamun! Just linking to where we had discussed this on Twitter: twitter.com/leighchalliday/status/1253054973140754433

  • @tajpouria
    @tajpouria 4 года назад

    Personally always enjoy your inspired performance :)

    • @leighhalliday
      @leighhalliday  4 года назад

      Hehe, thanks Charli!! Glad you enjoyed it!

  • @Skia_
    @Skia_ 4 года назад +1

    3:55 when she says you're just a brother to me and you try to suck it up xd

    • @leighhalliday
      @leighhalliday  4 года назад +1

      lol... it's really cause I couldn't remember the async/await syntax for normal functions... so I switched back to const approach. I do these things live and can't help making mistakes :D

  • @wateva9000
    @wateva9000 4 года назад

    Great video! What if I don't want to cache the results? Is there an explicit hook to be added to queryHook?

    • @leighhalliday
      @leighhalliday  4 года назад

      Hmmm... I'm not entirely sure if this would work, but you could try setting the `cacheTime` option to 0 (milliseconds) and see if that works!

  • @jaskaransingh100
    @jaskaransingh100 4 года назад

    Would react query cache the api response when i switch between pages? If not, could you recommend me a library or a process that would help with this.
    Current my ui is not very snappy because it always fetches data when i go to different routes on my website.
    Thank you for the great video. Loved it.

    • @leighhalliday
      @leighhalliday  4 года назад

      Hey Jaskaran! From what I can tell, much like SWR from Vercel, it uses a "stale-while-revalidate" caching approach where it displays old data while it is fetching new data: github.com/tannerlinsley/react-query#caching--invalidation
      There's also a `refetchOnWindowFocus` option you can set to false if you don't want it to refetch on window focus.

  • @leandrostickelhuber8947
    @leandrostickelhuber8947 4 года назад

    Great video!

    • @leighhalliday
      @leighhalliday  4 года назад

      Thanks Leandro! I appreciate the support!

  • @yigitruzgaruzun7289
    @yigitruzgaruzun7289 4 года назад

    You are wonderful man

  • @RezaPrayoga236
    @RezaPrayoga236 4 года назад

    Great Tutorial , Thanks Leigh,, I like your hairstyle.

    • @leighhalliday
      @leighhalliday  4 года назад

      Haha... it was better when I wasn't balding 😭

  • @richierob62
    @richierob62 4 года назад

    Does that library have debouncing or cancellation a la rxJS streams?

    • @leighhalliday
      @leighhalliday  4 года назад

      Hey Richard! I haven't used rxJS streams before... if I do one day, I'll let you know! I would imagine the purpose of the key is to avoid performing same query twice (debouncing), but it also supports cancellation, most likely triggered automatically when an existing key is no longer valid (or component has unmounted)... they have a piece in their documentation about this.

  • @abessesmahi4888
    @abessesmahi4888 4 года назад

    Thank you for your efforts.

    • @leighhalliday
      @leighhalliday  4 года назад

      Thank you Abesse, I'm glad you enjoyed the content!

  • @iNovotek
    @iNovotek 4 года назад

    Thanks, Buddy. Please how can I use react-redux action with react query?

    • @leighhalliday
      @leighhalliday  4 года назад

      Hey Emmanuel... what exactly are you trying to do?

  • @poatest1371
    @poatest1371 4 года назад

    Thank you very much it's very helpful and well explained. Do you have any paid course on Udemy or on any other platform looking forward to hear from you

    • @leighhalliday
      @leighhalliday  4 года назад +1

      Hey poa test! Nope, just here my friend :) Subscribe for weekly videos!!

  • @harshpathakful
    @harshpathakful 4 года назад

    Love you brother!

  • @AlJey007
    @AlJey007 4 года назад

    you don't have to await respose.json(), since you are turning the result

    • @leighhalliday
      @leighhalliday  4 года назад

      True! While technically correct, I'd say do whatever you find more readable... I think that's more important than technical performance here.

  • @marks3208
    @marks3208 4 года назад

    You are awesome. Thanks

    • @leighhalliday
      @leighhalliday  4 года назад

      Thank you!! I appreciate the support :)

  • @Mrstealurgrill
    @Mrstealurgrill 4 года назад

    why is something like this not in 'react' official? will it be added?

    • @leighhalliday
      @leighhalliday  4 года назад

      Hey Matthew! No clue :) I don't make react :D

    • @coadyx
      @coadyx 3 года назад

      React is a declarative view library, specifically a library (not a framework) that only cares about displaying data.
      That does not want to be bogged down with data fetching and caching semantics. A library like this I very much doubt will ever be added to react core.
      That said, React Suspense (which is coming) is a declarative way of modifying your view while you wait for something to complete. You can think of it as the view part of react query and swr.

  • @mrkhoros
    @mrkhoros 4 года назад

    I have some questions from time to time on your videos. Can I contact you ?

    • @leighhalliday
      @leighhalliday  4 года назад

      Hey Hypo! I'd love to help all I can, but it's very difficult because I am pretty busy without much free time... asking on RUclips and/or Twitter is the best because then other people can help out if I don't know or don't have time to provide a good answer.

    • @mrkhoros
      @mrkhoros 4 года назад

      @@leighhalliday Appreciate your effort and videos. Hands down you have got the best React based videos on RUclips. Keep up the good work.

  • @MrRuchir23
    @MrRuchir23 4 года назад

    @
    Leigh Halliday, Awesome video , Please cover Xstate For react, there are no good videos on this topic on youtube

    • @leighhalliday
      @leighhalliday  4 года назад +1

      Hey Ruchir! I believe I have 3 videos on that very topic :D
      ruclips.net/video/iDZxjJYMOUQ/видео.html
      ruclips.net/video/XaHk9vhmus4/видео.html
      ruclips.net/video/d8V5vcZOQe4/видео.html

    • @MrRuchir23
      @MrRuchir23 4 года назад

      @@leighhalliday Thanks cheked them, a state management of complex from through
      Xstate will be a great addition to this list

  • @lautarojayat7914
    @lautarojayat7914 4 года назад +1

    f*ck! Dave Grohl is doing awsome react tutorials! Nirvana, Foo, and now front-end! Love this guy

    • @leighhalliday
      @leighhalliday  4 года назад +1

      lol, not sure how much I look like him, but I'll take it!

  • @blackpilledbuddha4944
    @blackpilledbuddha4944 4 года назад

    I am working towards becoming a full stack web dev... currently i have good grasp of front end js frameworks. What shouls I focus for the backend that would complement the frontend, i was wondering PHP(my node knowledge is pretty decent) ?

    • @andyslezak3606
      @andyslezak3606 4 года назад +1

      My vote would be to stick with JavaScript (Node.js) / Python on the backend. Here is a good roadmap for you to help plan your journey: roadmap.sh/backend

    • @leighhalliday
      @leighhalliday  4 года назад +2

      Andy's advice seems solid!!

    • @blackpilledbuddha4944
      @blackpilledbuddha4944 4 года назад

      Much appreciated

  • @andrew.tremblay
    @andrew.tremblay 3 года назад

    16:30 🇨🇦

  • @Telladriel
    @Telladriel 4 года назад

    Wish you dived more into configs and their possibilities rather than the simple fetch

    • @leighhalliday
      @leighhalliday  4 года назад +2

      Sorry Noel! I didn't want to take those fun times away from you! :D The truth is that there are a few reasons: 1) The more complicated the example, the more I lose people and also forget what the heck I'm even doing... and 2) Often I use this as a way for me to learn and try out a new package... so I'm not really solving a real production need, and haven't dived into all the config options myself.