O3 Framework / usePagination
usePagination<
T>(data,resultsPerPage):object
Defined in: packages/framework/esm-react-utils/src/usePagination.ts:20
Use this hook to paginate data that already exists on the client side. Note that if the data is obtained from server-side, the caller must handle server-side pagination manually.
goTo, goToNext and goToPrevious keep the same identity for the life of the component, so they are
safe to list in a dependency array. currentPage is bounded by the data, so it can change on its own
when the data shrinks; a component reacting to currentPage should expect that.
T
T[] = []
number = defaultResultsPerPage
object
currentPage:
number=page
goTo: (
page) =>void
number
void
goToNext: () =>
void
void
goToPrevious: () =>
void
void
paginated:
boolean
results:
T[]
showNextButton:
boolean
showPreviousButton:
boolean
totalPages:
number
useServerPagination for hook that automatically manages server-side pagination.useServerInfinite for hook to get all data loaded onto the client-side