Pagination in React Tutorial with React Query, Hooks Examples

Поділитися
Вставка
  • Опубліковано 8 лис 2024

КОМЕНТАРІ • 58

  • @raymondmichael4987
    @raymondmichael4987 2 роки тому +4

    Dude now you're becoming my addiction.
    Please more examples with redux-toolkit,
    I'm watching your Playlist this whole week

  • @bakaryditdadadrame4638
    @bakaryditdadadrame4638 2 роки тому +5

    Thank you very much, you're one of the best teachers and coders on UA-cam. You're a pro coder, your content helped me a lot. God bless you, Dave!!!

  • @Pareshbpatel
    @Pareshbpatel 2 роки тому +1

    An excellent illustration of using Pagination of API Data, with and without react-query. Concise, yet comprehensive Thanks, Dave
    {2022-11-17}

  • @evgeniy3370
    @evgeniy3370 2 роки тому +1

    Thanks man! Best pagination performance I've found on youtube.

  • @nicholasbrown4372
    @nicholasbrown4372 2 роки тому +2

    I have been waiting for videos like this. I wish you could do videos on key functionalities in React like Search, Pagination etc. Great work Dave!

  • @nixonlim4715
    @nixonlim4715 2 роки тому +1

    Thank you for making this! I love react query, one of my favourite react library out there! I hope you can make a tutorial about react table library soon...

  • @ahmad-murery
    @ahmad-murery 2 роки тому

    Hello,
    On example#2 at 16:47 we can benefit from Array.from() method to create pageArray range like this:
    const pageArray = Array.from({length:user.total_pages}, (_, i) => i+1)
    or
    const pageArray = Array.from(Array(user.total_pages), (_, i) => i+1)
    also, when clicking first/last buttons the first/last page number didn't highlighted,
    maybe we can set a "selected" class on page buttons according to the page number came back from the api
    Thanks Dave, that was awesome video as usual,

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому +1

      Thanks, Ahmad! Yes, there are many ways to fill an array with numbers including both your examples and mine. Additionally, others are listed here, too: stackoverflow.com/questions/3746725/how-to-create-an-array-containing-1-n
      The page number highlighting issue is something I noted in the Github source. It happens due to the isPreviousData changing which creates a re-render. We could apply the useRef hook and select / focus a referenced element. If you omit passing the isPreviousData prop, you can also retain the highlight color.
      Always thoughtful comments, Ahmad 💯 In Kansas, they would say "You keep me on my toes!" which means you keep me thinking!

    • @ahmad-murery
      @ahmad-murery 2 роки тому

      @@DaveGrayTeachesCode Nice reference, I actually found mine on MDN but I chose the shortest ones 😎(old habit)
      I just noticed your reop changes, thanks for that update,
      I really appreciate your kind words and I actually can say the same thing about you, except that it's always easier to put notes on something than to create something.
      You keep me thinking!💯📈

  • @santosh_ksh7
    @santosh_ksh7 2 роки тому

    Awesome man. It really helped me to glide smoothly.

  • @Andreas-oq2gz
    @Andreas-oq2gz 2 роки тому +1

    Your content is beneficial for me. thank you so much, Dave!
    if you don't mind can you create a tutorial for pagination using rtk query? Thank you

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому

      You're welcome, Andreas! RTK Query does not include any built-in pagination behavior, but I could use it and apply pagination much like this tutorial does. Here is a link to the RTKQ discussion: redux-toolkit.js.org/rtk-query/usage/pagination

  • @fares.abuali
    @fares.abuali 2 роки тому +1

    Much informative ⭐

  • @aileenchan3741
    @aileenchan3741 Рік тому

    Thank you for always sharing great content! : )

  • @WildHowlYT
    @WildHowlYT 2 роки тому +1

    Great job, there is always something to learn about React 💙

  • @chunkwanchan5503
    @chunkwanchan5503 Рік тому

    Amazing understandable tutorial!

  • @mohammadmo9290
    @mohammadmo9290 Рік тому

    Great tutorial 👌

  • @vincent3542
    @vincent3542 2 роки тому +1

    hello dave, as usual your content is beyond my expectation 😉😍`
    oh yeah, regarding react query, in general can you say that the concept and implementation that RQ has, is the same or even exceeds redux?
    because I see that RQ is very popular and in demand by many users, especially about the infiniteScroll 💪🔥

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому +2

      Until projects are enterprise-sized, modern Redux could be overkill. RTK Query is great and can be used in many ways like React Query. That said, React Query does make some things simpler and it is great for smaller to medium projects. They aren't the same - but many times cached data is all that is needed instead of a full global state solution like Redux. And infinite query and scroll - I plan to cover those, too!

    • @vincent3542
      @vincent3542 2 роки тому

      @@DaveGrayTeachesCode Yes I agree, that's what I thought too, back to our own project level.
      Can't wait for the tutorial ❤️💪

    • @mrbilchalan
      @mrbilchalan 2 роки тому

      @@DaveGrayTeachesCode thank you and yes, infinite scroll will be appreciated. Browsers address bar should be changed to -?page=1, page=2 .I feel difficulty to do that :)

  • @usamasaleem5624
    @usamasaleem5624 2 роки тому

    Your content is very awesome and advanced. I have one request can you please make a react query series and some advanced topics like AWS, Remix, Redis, GraphQL, Microservices, Microfrontend, React Advanced Code Structure and also some Advanced React Native. I know it takes a lot of time. When you have time so please make the videos on mentioned topics it's very helpful for us
    And once again thanks for the awesome content.

  • @varileshtlesht7091
    @varileshtlesht7091 2 роки тому

    Thnx Dave, great explanation.
    Are you planing on releasing Typescript videos? Ore some kind of MERN project with redux and Typescript?

  • @ОраОра-б7г
    @ОраОра-б7г 2 роки тому

    thanks! This video helped me))

  • @biLLie_wiLLie
    @biLLie_wiLLie 2 роки тому +1

    Should the backend give client paginated data? Is it good if you get 100k users list and make pagination in react?

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому +3

      You should get paginated data from the backend when appropriate. Requesting 100k records all at once will likely timeout, and if miraculously successful, may crash your frontend.

    • @biLLie_wiLLie
      @biLLie_wiLLie 2 роки тому

      @@DaveGrayTeachesCode I'm learning laravel now and see that I'm able to send paginated data. In node js it's possible too. Anyway thank you for your lessons. I love it

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому

      @@biLLie_wiLLie you're welcome!

  • @avgspacelover
    @avgspacelover 2 роки тому

    amazing content!!!

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому

      Thank you!

    • @avgspacelover
      @avgspacelover 2 роки тому

      @@DaveGrayTeachesCode can you please revisit currying, I watched that add customer, complete order sequence of function in the video, 3times but I still didn't understand 😞

  • @aliciapeter562
    @aliciapeter562 2 роки тому

    Thank you! 👌

  • @dharmeshgohil9375
    @dharmeshgohil9375 2 роки тому +1

    awesome

  • @RdozeTV
    @RdozeTV 2 роки тому +2

    Can you please use typescript next time. Javascript is obsolete no one using that

  • @srinivasaraoyp3640
    @srinivasaraoyp3640 2 роки тому

    Another interesting tutorial.

  • @divewithsk
    @divewithsk 2 роки тому

    in example 2 i am getting blank screen in console this error is coming how to solve this error..
    //Uncaught Error: No QueryClient set, use QueryClientProvider to set one//

    • @DaveGrayTeachesCode
      @DaveGrayTeachesCode  2 роки тому +1

      Look at my example code available at the link in the description. The index.js has to provide the query client for React Query. Also reference my intro to React Query here: ua-cam.com/video/lLWfZL-Y8lM/v-deo.html

    • @divewithsk
      @divewithsk 2 роки тому

      @@DaveGrayTeachesCode i added the queryclient set in index root file now my issue got solved .thank you for your response

  • @maximodakila2873
    @maximodakila2873 6 місяців тому

    Oh please, be a grown up and use typescript

    • @keifer7813
      @keifer7813 5 місяців тому

      Takes a daredevil to code without it ;)