@postinumero/use-pager-query-param
v0.2.2
Published
Hook for syncing a pager component with a URL query parameter.
Downloads
107
Readme
@postinumero/use-pager-query-param
Hook for syncing a pager component with a URL query parameter.
page = 0
maps to empty query parameter (or ?page=1
), page = 1
maps to ?page=2
etc.
Install
npm install @postinumero/use-pager-query-param use-query-params query-string
API
usePagerQueryParam(name: string)
import usePagerQueryParam from '@postinumero/use-pager-query-param';
export default function QueryParamPager() {
const [page, setPage] = usePagerQueryParam('page');
return <Pager page={page} onChangePage={setPage} />;
}