usePaginator
Sourceimport { usePaginator } from "@prestojs/util";
Hook to help manage paginator state. An instance of the specified paginator is created with provided state setter or a default setter if none provided. You only need to provide a state setter if you want to store the state somewhere external e.g. from URL query parameters.
See examples for CursorPaginator, PageNumberPaginator or LimitOffsetPaginator
Arguments:
Argument | Type | Description | |
---|---|---|---|
* | paginatorClassOrProvider | null|| | Must either be an object with a |
currentStatePair | [undefined|PaginatorState, ] | A tuple of current state and a state setter function. If not provided state
is handled internally in usePaginator. You can pass |
Returns:PaginatorT|null
The paginator class instance