DEV Community

Discussion on: Using a React Table with Client-Side Pagination

Collapse
 
preyasprathap profile image
preyas prathap • Edited

Nice. 👍

But on refreshing, the page downloads the entire table data right.

I want to fetch the data only when the user clicks page no ?

Do you know how to do that.

Collapse
 
maxxgreene profile image
Maxx Greene React Rainbow

the use case of doing the pagination 100% on the client apply only for when you know you dataset is small, <2000 records. You don't want you table to render in the DOM 2000 rows then you paginate in the client for performance reasons(less DOM elements)

Fetching that amount of data(<2000) is not a problem today in my opinion. If the use case is other(> 2000 records) then server side pagination :)

Valid to say the 2000 records is a number made my me :) ... it could be more or less

Collapse
 
leandrotorressicilia profile image
LeandroTorresSicilia React Rainbow

Yes refreshing the page downloads all the data. With the TableWithBrowserPagination component right now you can only do client-side pagination, if you want to do server-side pagination, then you could use the Pagination and Table components. Pagination has an onChange prop that receives the selected page number, then knowing the page you can call an API with pagination and get only the page data. Maybe I will write another post using server-side pagination.

Thanks for reading.