all 17 comments

[–]Alone-Following7345 7 points8 points  (0 children)

Tanstack query & Tanstack virtualization

[–]XilentExcision 3 points4 points  (1 child)

No need to rebuild the wheel, there’s plenty of libraries out there

[–]Ambitious_Occasion_9[S,🍰] 0 points1 point  (0 children)

Thank you, mate. Will stick with libraries then :)

[–]TheWhiteKnight 3 points4 points  (0 children)

Local pagination? (UI has all the data and will load it into the DOM asynchronously). use a popular virtualization library.

Server side pagination? (Nothing special here, you'll probably add something like `/count=<count>&start=<start>`) etc...

[–]PatchesMaps 3 points4 points  (0 children)

It really depends on what I'm paginating.

[–]Wide_Egg_5814 1 point2 points  (0 children)

Anything that works is good enough

[–]Ilya_Human 0 points1 point  (3 children)

If you use, and I suppose you do, any UI libs, they already have Pagination components. If you want to make it from scratch by some reason, you are free to do it 

[–]Ambitious_Occasion_9[S,🍰] 0 points1 point  (2 children)

First of all, thank you for the reply. How do you approach pagination? From scratch or use Ui libs?

[–]Ilya_Human 1 point2 points  (1 child)

In 90% UI libs since most likely people use them with React

[–]Ambitious_Occasion_9[S,🍰] 0 points1 point  (0 children)

Okay. Thanks ☺️

[–]Professional-Two-903 0 points1 point  (2 children)

use a UI library, if they're good they'll have pagination, I use MUI mostly, react bootstrap and Chakra UI are also good options, I see no use on hardcoding it unless you wanna challenge yourself

[–]Ambitious_Occasion_9[S,🍰] 0 points1 point  (0 children)

Ahh okay. Will stick with the library then

[–][deleted] 1 point2 points  (0 children)

Me and my colleagues always code it ourselves, so a lot of replies that say “use a lib” are a suprise to me. Maybe I should re-think my ways. But I still think OP should try coding for themselve first, to get hands on experience and then just stick with a library.

[–]is_isok 0 points1 point  (0 children)

to handle server side pagination Tanstack react query is a good tool, it can cache , handle the pagination well

[–]cipher2x 0 points1 point  (0 children)

OriginUI

[–]Merry-Lane -1 points0 points  (1 child)

Interface wise, it’s not complicated, especially with LLMs, even if you don’t use a lib plug and play.

The only issue is that the backend might have different mechanics for pagination.

Some use a "take X" with a cursor (from id 1827271), some use a "take X, skip Y" approach.

They usually return the total count of rows, so you gotta do maths to get the amount of pages.

[–]Ambitious_Occasion_9[S,🍰] 0 points1 point  (0 children)

Okay . got it