UNPKG

koval-ui

Version:

React components collection with minimalistic design. Supports theming, layout, and input validation.

27 lines (26 loc) 598 B
"use client"; import { useState as f, useEffect as u, useCallback as r } from "react"; const x = ({ paginationProp: s, onPaginationChange: a }) => { const [e, t] = f(s); u(() => { t(s); }, [s]), u(() => { a(e); }, [a, e]); const g = e.pageIndex + 1, o = r((c) => { t((n) => ({ ...n, pageIndex: c - 1 })); }, []), i = r((c) => { t((n) => ({ ...n, pageSize: c })); }, []); return { pagination: e, setPagination: t, currentPage: g, setCurrentPage: o, setPageSize: i }; }; export { x as usePagination }; //# sourceMappingURL=usePagination.js.map