usePaginator

Source
import { usePaginator } from "@prestojs/util";
usePaginator(paginatorClassOrProvider,?currentStatePair)

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 eg. from URL query parameters.

ParameterTypeDescription
*paginatorClassOrProviderPaginatorInterfaceClass|PaginatorClassProvider

Must either be an object with a getPaginatorClass method (eg. Endpoint) or a Paginator class. This class defines how pagination is handled.

currentStatePair[PaginatorState,
Function
]

A tuple of current state and a state setter function. If not provided state is handled internally in usePaginator. You can pass useState() to this parameter.

PaginatorInterface
usePaginator(paginatorClassOrProvider,?currentStatePair)
ParameterTypeDescription
*paginatorClassOrProvidernull
currentStatePair[PaginatorState,
Function
]
null
usePaginator(paginatorClassOrProvider,?currentStatePair)
ParameterTypeDescription
*paginatorClassOrProviderPaginatorInterfaceClass|PaginatorClassProvider|null
currentStatePair[PaginatorState,
Function
]

One of the following:

PaginatorInterface

OR

null