mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
15 lines
349 B
TypeScript
15 lines
349 B
TypeScript
import { parseAsInteger, useQueryState } from 'nuqs';
|
|
|
|
export const useItemListPagination = () => {
|
|
const [currentPage, setCurrentPage] = useQueryState(
|
|
'currentPage',
|
|
parseAsInteger.withDefault(0),
|
|
);
|
|
|
|
const onChange = (index: number) => {
|
|
setCurrentPage(index);
|
|
};
|
|
|
|
return { currentPage, onChange };
|
|
};
|