React SDK

usePagination

usePagination provides conveniences that allow user to integrate the Pagination component with the search context on the fly.

Usage

Editable Example
​
Suggestions
    Site search by

    Loading...

    Anatomy

    usePagination returns an object containing the following properties:

    NameTypeDefaultDescription
    pageCountnumber0The number of pages.
    totalResultsnumber0The total number of results.
    resultsPerPagenumber10The number of results per page.
    pagenumber1The current page.
    setPage(pageNum: number) => voidA method for setting the page.
    hasNextbooleanA boolean to determine if there is a next page.
    hasPreviousbooleanA boolean to determine if there is a previous page.
    nextPage() => voidGo to next page, do nothing if hasNext is false.
    previousPage() => voidGo to previous page, do nothing if hasPrevious is false.

    Parameters

    NameTypeDefaultDescription
    key"search" | "autocomplete"'search'The search mode.