Skip to main content

calculatePage

Content

Used for next page calculation.

calculatePage

Used to calculate next page which will be requested from remote server by using calculation based on current page size and current page.

Params

NameTypeRequiredDefault valueDescription
countNumberTrue-Current total count of items
pageSizeNumberFalse20Size of items in a page

Usage example

export async function getOrders(listLength: number, loadState: LoadState) {
const page = loadState == LoadState.pullToRefresh || loadState == LoadState.refreshing ? 1 : calculatePage(listLength);

return await ordersApi.getOrders({
page: page,
sorting: defaultOrdersSorting,
});
}