Infinite Pagination Component With React Query

  Рет қаралды 21,052

Cosden Solutions

Cosden Solutions

Күн бұрын

Repo → github.com/cos...
Join The Discord! → discord.cosden...
VSCode Theme | Font → Material Theme Darker | Menlo, Monaco "monospace"
In this video I will show you how to build an infinite pagination component with React Query. This component will be able to infinitely load multiple pages of data and show them all together on the screen as the user scrolls through the application. We'll be using Tanstack Query for this as well as react-intersection-observer, which is a library that will help us trigger a fetch of the next page. Enjoy!

Пікірлер: 41
@akshatpandey2609
@akshatpandey2609 7 ай бұрын
please make a video on Best Design Practices with React Query - with custom hooks, where we have a lot of api requests
@AbsolutePain
@AbsolutePain 7 ай бұрын
Include auth context , react router dom too 👀
@balls991
@balls991 6 ай бұрын
I watched and read so many tutorials about useInfiniteQuery, none of them explained the details. Thank you so much.
@hamzaeshoul
@hamzaeshoul 5 ай бұрын
Very clear and easy to understand. Thank you so much for your dedication to all react developers !
@gufranlazuardi
@gufranlazuardi 2 ай бұрын
Your explanation was very clear and easy to understand. Thank you!
@jomoc6112
@jomoc6112 3 ай бұрын
I did not know there was such a thing as this. I have implemented the same output, but through a much harder path. :( . new subscriber here
@98saiful
@98saiful 7 ай бұрын
Love your new background!
@haghighi251
@haghighi251 6 ай бұрын
Instead of using "Chapter X" please use a name that is relevant to each section title so we can jump to a specific part directly. It will be useful especially when we want to go to a specific part of the video without searching all Chapters :D. By the way, The video is so clear and useful. Thanks for making it.
@dnguyendev
@dnguyendev 5 ай бұрын
concise, easy to understand, the best react-query pagination tutorial!
@mohamedsalimbensalem6118
@mohamedsalimbensalem6118 7 ай бұрын
what if we fetched tooo many, the website will become laggy can you do a video how to do virtualization for performance... and what if the component can dynamically increase in size how can i still impliment the virtualization in this case ?
@tangaka3996
@tangaka3996 7 ай бұрын
the react intersection observer returns a ref that will be used to check if its is in view and put to the very last item of a page.
@penaf
@penaf 7 ай бұрын
Nested ternaries for the win! :) Gr8 tutorial as always
@arpithagm2231
@arpithagm2231 3 ай бұрын
is onSuccess being deprecated from useInfiniteQuery? If so, what is the alternative for onSuccess?
@MarselNz
@MarselNz 5 ай бұрын
That's exactly what I wanted to know, thanks!
@worldofkent576
@worldofkent576 7 ай бұрын
How would you Implement by scrolling upwards like messenger app, then refetch old data/message and grows the container upwards?
@Gokulakannannedunchezhiyan
@Gokulakannannedunchezhiyan 7 ай бұрын
In this example fetched items are added to the bottom of the list. But in your case we have to add at the top and keep the observer item on the top.
@enriquesalomon8197
@enriquesalomon8197 4 ай бұрын
using the infinite pagination, it is possible to implement it with a react-select? like a scrolling at a bottom will trigger the fetching the nextpage ? and also like searching in the select input if no data found in the cached , it will refecth again to the server side as a searching parameter, the return the data and added to the cached. ?
@catalincatalin4101
@catalincatalin4101 7 ай бұрын
Great video, thanks. Your volume on the microphone seems a bit low.
@waleedsharif618
@waleedsharif618 7 ай бұрын
Will you create a video where you talk about React 19 ? It seems to be very interesting
@enriquesalomon8197
@enriquesalomon8197 4 ай бұрын
I want to ask , in using react-select with reactjs, react query and supabase stack, i want to load all the data from the supabase that is almost 200000 of data, the problem is only 1000 is being display in the react-select, as we know displaying large of data into client side may effect performance, and what solution can be use in order to display all tha data in the react-select?
@FatahChan
@FatahChan 7 ай бұрын
Doesn't this re-renders the whole items that was already fetched
@widurahasta9473
@widurahasta9473 Ай бұрын
do you know how to create infinite scroll up to load history chat like whatsapp? i'm struggle do it
@godofwar8262
@godofwar8262 7 ай бұрын
Please make a single video for typescrpit crash course
@mohamedyamani8502
@mohamedyamani8502 7 ай бұрын
Great video as always. I wonder why you use status instead of isLoading?
@cosdensolutions
@cosdensolutions 7 ай бұрын
Status works for error and loading, so no need for isLoading and isError
@danielchukwu524
@danielchukwu524 5 ай бұрын
If I could subscribe again, I absolutely would
@ghostaccountlmao
@ghostaccountlmao 7 ай бұрын
Very important, thanks.
@yourlinuxguy
@yourlinuxguy 3 ай бұрын
Very nice video but this will not work if you zoom out the page to the point that the last element doesn't touches the end scree. Then in that scenario load more pages won't fire. And thus the infinite scroll won't work. Just to keep this thing in mind.
@josephito27
@josephito27 14 күн бұрын
those are edge cases, to start with.. why would anyone do that? and in such cases you can just render a "load more" button if the observer is on view the whole time, idk
@deanolium
@deanolium Күн бұрын
From a UX pov, you'd want to actually put the observer ref on either one of the items before the last one, or at least make the observer div (though semantically that's ick) before there, so that it starts fetching before the user actually gets to the bottom of the list. Giving the illusion of being a real infinite list instead of one that has to buffer in whenever you get to the bottom. That said, useInview fires when the referenced component is in the viewport, not just when it crosses the bounds. So zooming out the page will still cause it to trigger.
@monoq_
@monoq_ 5 ай бұрын
Thank you. I need this
@JoshLearningFrontend
@JoshLearningFrontend 7 ай бұрын
Create a video describing the react server component (RSC)
@imatrules
@imatrules 7 ай бұрын
What's the best way to handle toggle switches i have a page with a lot of them and i don't like the large amount of states?
@abhishek7056
@abhishek7056 7 ай бұрын
How can we do this in nextjs 14 server components ? I mean without reactquery and useEffect
@dipanshusabharwal
@dipanshusabharwal 7 ай бұрын
Are you planning to come up with a React course ?
@cosdensolutions
@cosdensolutions 7 ай бұрын
Yeah, coming out in a month!
@Ray-ko6cw
@Ray-ko6cw 6 ай бұрын
Than you bro :)
@fabioalcocersejas2944
@fabioalcocersejas2944 7 ай бұрын
The link to the repository I think it sends to the wrong project
@cosdensolutions
@cosdensolutions 7 ай бұрын
you're right, fixed. Thanks!
@Temp-pn4lm
@Temp-pn4lm 4 ай бұрын
Wish you told me how to actually use the hook instead of one example. my back-end works way different than watch dummy code you represented so the video was useless to me
Efficiently Render 100,000 Rows in React
16:41
Cosden Solutions
Рет қаралды 18 М.
How to Create Infinite Scroll in React | TanStack React Query
35:07
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 16 МЛН
Amazing Parenting Hacks! 👶✨ #ParentingTips #LifeHacks
00:18
Snack Chat
Рет қаралды 21 МЛН
Why I don't use React-Query and tRPC in Next.js
18:58
ByteGrad
Рет қаралды 89 М.
Combining Zustand with React Query
20:24
Cosden Solutions
Рет қаралды 18 М.
Refactoring a React component - Design Patterns
15:19
Cosden Solutions
Рет қаралды 96 М.
How I Write Clean Code in React
16:36
Cosden Solutions
Рет қаралды 30 М.
Infinite Scrolling in NextJs 13 Using Server Actions
17:58
Hamed Bahram
Рет қаралды 22 М.
Compound Components in React (Design Patterns)
18:21
Cosden Solutions
Рет қаралды 40 М.
React Query Is (Still) Essential - My Favorite React Library
11:04
Theo - t3․gg
Рет қаралды 152 М.
React Query Tutorial - 19 - Paginated Queries
9:03
Codevolution
Рет қаралды 40 М.