vapor-chamber API reference - v1.16.0
    Preparing search index...

    Function usePagination

    • Pagination over a loader-backed list, driven entirely by the URL.

      page is a query param, so a page change is STATE, not navigation: no matching, no guards, no remount — only the loaders whose template depends on the key refetch, with the previous request aborted. page pushes by convention, so Back steps through pages, and the URL is shareable.

      const { items, page, hasNext, next, pageRange, loading } = usePagination();

      Reading the response is the only part that varies between backends, so each extractor is overridable; the defaults accept { items | data } with { total, per_page | perPage, last_page | lastPage } (or their meta nesting), which covers Laravel's paginator and most plain-JSON APIs.

      Type Parameters

      • T = unknown

      Parameters

      Returns Pagination<T>