Redux
Advanced
Infinite Queries
Implement pagination and infinite scroll patterns with RTK Query.
25 min
2 sections
pagination
infinite-scroll
queries
1
2
01. Pagination Concepts
Section 1 of 2
Infinite queries load data in pages as users scroll. Each request fetches the next batch of results.
typescript
// Paginated endpoint
builder.query({
query: (page) => '/posts?_page=' + page + '&_limit=10',
}),
// Component with merge strategy
const [page, setPage] = useState(1);
const { data, isFetching } = useGetPostsQuery(page);Back to Course