Documentation
Base
Contexts
PagesContext

usePagesContext

Description

The usePagesContext hook is a React hook designed to manage the state and behavior of pages within a component. It handles the navigation between pages, the current page index, and any associated props or child elements. This hook is useful for implementing pagination or story-like features in applications.

Properties

PropertyTypeDescription
canNextbooleanIndicates whether the next page can be shown.
canPreviousbooleanIndicates whether the previous page can be shown.
childrenReact.ReactNodeThe children elements of the pages.
currentnumberThe current page index.
lengthnumberThe total number of pages.
mountednumberIndicates that pages context was mounted.
nextFunctionFunction to show the next page or story.
previousFunctionFunction to show the previous page or story.
propsPagesPropsThe props of the pages.
show(index: number) => voidFunction to show a specific page by index.