> ## Documentation Index
> Fetch the complete documentation index at: https://staging-docs.orderly.network/llms.txt
> Use this file to discover all available pages before exploring further.

# usePrivateInfiniteQuery

> Hook for paginated private API queries with infinite scroll support.

Position list or order lists typically requires pagination to load all the data. If an infinite scrolling effect has to be implemented `usePrivateInfiniteQuery` can be used.

* [Tech docs](/sdks/tech-doc/modules/orderly_network_hooks#useprivateinfinitequery)

**Slightly different from sending an incremental `page` parameter, `usePrivateInfiniteQuery` will append data from the next `page` to `data`, and not replace the current response.**

For example, to get the list of orders:

```tsx theme={null}
const { data: orders } = usePrivateInfiniteQuery(
  (pageIndex: number, previousPageData) => {
    // reached the end
    if (previousPageData && !previousPageData.length) return null;

    const search = new URLSearchParams([
      ["size", size.toString()],
      ["page", `${pageIndex + 1}`]
    ]);

    if (status) {
      search.set(`status`, status);
    }

    if (symbol) {
      search.set(`symbol`, symbol);
    }

    if (side) {
      search.set(`side`, side);
    }

    return `/v1/orders?${search.toString()}`;
  },
  {
    initialSize: 1,
    onError: (err) => {
      console.error("fetch failed::::", err);
    }
  }
);
```
