Edit in GitHubLog an issue

usePagination()

Functions

usePagination(config)Array.<Object>

A React Hook that provides pagination logic.

Use this hook to implement components that need to navigate through paged data.

The current pagination state

Properties

NameTypeDescription
currentPageNumberThe current page number
totalPagesNumberThe total number of pages

The API object used for modifying the PaginationState.

Set the current page

Parameters

NameTypeDescription
pageNumberThe number to assign to the current page

Set the total number of pages

Parameters

NameTypeDescription
totalNumberThe number to set the amount of pages available

A React Hook that provides pagination logic.

Use this hook to implement components that need to navigate through paged data.

Returns: Array.<Object> — An array with two entries containing the following content: [ PaginationState, API ]

Parameters

NameTypeDefaultDescription
configObjectAn object containing configuration values
config.namespaceString''The namespace to append to config.parameter in the query. For example: ?namespace_parameter=value
config.parameterString'page'The name of the query parameter to use for page
config.initialPageNumberThe initial current page value
config.initialTotalPagesNumber1The total pages expected to be usable by this hook

Source Code: pwa-studio/packages/peregrine/lib/hooks/usePagination.js

  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.