Components/usePagination

usePagination

All pagination logic decoupled from UI. Returns current page, total pages, and navigation helpers.

Installation

Usage

API Reference

PropTypeDefaultDescription
pagenumberCurrent 1-based page number.
pageSizenumberItems per page.
totalPagesnumberCalculated total pages.
fromnumberFirst item index on current page.
tonumberLast item index on current page.
hasPrevbooleanTrue when page > 1.
hasNextbooleanTrue when page < totalPages.
goTo(page) => voidNavigate to a specific page.
goNext() => voidGo to the next page.
goPrev() => voidGo to the previous page.
setPageSize(n) => voidChange items per page.