Contents

About useInfiniteQuery

   Jun 15, 2023     0 min read

This is a post about useInfiniteQuery (infinite scrolling).

What is infinite scroll?

A user experience approach where content continues to load when the user reaches the bottom of the page.

Uses

It is primarily used in pagination. You use it when you want to show a large amount of data at once while minimizing the userโ€™s clicks.

  • Itโ€™s easy to think of it as a way of describing an action: you bring up a certain number of items and press a button to load a set of data. The infinite scrolling should stop when the data has been loaded. This way, the infinite scrolling allows for the personalization that users want for their options.
How to use
  1. insert queryFunction and queryParams into the properties of useInfiniteQuery.
  2. in queryFunction, enter the infinite scroll target API, i.e. the dataset you want to fetch.
  3. for queryParams, enter the variables you want to store for a fixed number of rows of data.