Pagination
The Storefront API uses cursors to paginate through lists of data and the <Pagination /> component makes it easy to paginate data from the Storefront API. It is important for pagination state to be maintained in the URL, so that the user can navigate to a product and return back to the same scrolled position in a list. It is also important that the list state is shareable via URL. The <Pagination> component provides a render prop with properties to load more elements into your list.
Anchor to propsProps
- Anchor to childrenchildrenchildrenPaginationRenderProp<NodesType>PaginationRenderProp<NodesType>requiredrequired
A render prop that includes pagination data and helpers.
- Anchor to connectionconnectionconnectionConnection<NodesType>Connection<NodesType>requiredrequired
The response from
storefront.queryfor a paginated request. Make sure the query is passed pagination variables and that the query haswith,,, anddefined.- Anchor to namespacenamespacenamespacestringstring
A namespace for the pagination component to avoid URL param conflicts when using multiple
Paginationcomponents on a single page.
PaginationRenderProp
- contextTypes
ValidationMap<any> | undefined - defaultProps
Used to define default values for the props accepted by the component.
Partial<P> | undefined - displayName
Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.
string | undefined - propTypes
Used to declare the types of the props accepted by the component. These types will be checked during rendering and in development only. We recommend using TypeScript instead of checking prop types at runtime.
WeakValidationMap<P> | undefined
Connection
{
nodes: Array<NodesType>;
pageInfo: PageInfo;
} | {
edges: Array<{
node: NodesType;
}>;
pageInfo: PageInfo;
}