File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,10 +60,10 @@ export function usePaginate<T>(items: T[], options: UsePaginateOptions = {}) {
6060 const lastPageIndex = safeIndex ( pageCount - 1 ) ;
6161 const nextPageIndex = safeIndex ( pageIndex + 1 ) ;
6262 const prevPageIndex = safeIndex ( pageIndex - 1 ) ;
63+ const canFirstPage = pageIndex !== 0 ;
64+ const canLastPage = pageIndex !== lastPageIndex ;
6365 const canNextPage = pageIndex < lastPageIndex ;
6466 const canPrevPage = pageIndex > 0 ;
65- const canFirstPage = pageIndex > 0 ;
66- const canLastPage = pageIndex > 0 ;
6767
6868 useEffect ( ( ) => {
6969 if ( pageIndex > lastPageIndex ) {
@@ -109,6 +109,8 @@ export function usePaginate<T>(items: T[], options: UsePaginateOptions = {}) {
109109 }
110110
111111 return {
112+ canFirstPage,
113+ canLastPage,
112114 canNextPage,
113115 canPrevPage,
114116 changePage : handleChangePage ,
You can’t perform that action at this time.
0 commit comments