usePageParams
usePageParams reads page and size from the current URL (via React Router’s useSearchParams) and returns a small object you can pass directly into useData/useTypedData to populate page and size query parameters.
Source: src/api/usePageParams.ts
Signature
Behavior
- Reads
pageandsizefrom the URL. - Supports namespacing multiple paginators on a page via
prefix:- With
prefix: 'comments'it readspage_commentsandsize_comments.
- With
- Defaults:
pagedefaults to 1sizedefaults todefaultSize(if provided) or 25
- Exposes
paginationProperties, a readonly list of field names to include in shapes when working withApiListResult<T>responses.
Examples
Basic list with paging
With shapes for paginated responses
Multiple independent paginators
Notes
usePageParamsonly reads params; updating page/size is done viauseSearchParamsor Link navigation.- The hook is UI-agnostic and doesn’t render anything; it’s safe to use anywhere.