Skip to main content
zerotal

Documentation


Documentation / @zerotal/inertia / scroll

Function: scroll()

scroll(value, options?): InfiniteScrollProp

Defined in: inertia/src/props/PropTypes.ts:357

Infinite-scroll prop: merges paginated data and emits scrollProps so the client <InfiniteScroll> component knows when to load the next/previous page.

Parameters

value

PropFactory | PaginatorLike

A paginator (or factory producing one) with data plus page metadata.

options?

pageName (query param driving pagination, default "page") and dataPath (path to the array to merge, default "data").

pageName?

string

dataPath?

string

Returns

InfiniteScrollProp

An InfiniteScrollProp wrapper.

Example

return inertia('Posts/Index', { posts: scroll(() => Post.paginate(15, page)) });
// custom page-query name:
return inertia('Items', { items: scroll(() => Item.paginate(15, page), { pageName: 'p' }) });