useList is a modified version of TanStack Query’s useQuery for retrieving items from a resource with pagination, sorting, and filtering.
It uses the getList method from the dataProvider.
Usage
Parameters
Resource name for API data interactions. If not provided, it will be inferred from the route.
Pagination configuration for the query.
Sorter parameters for ordering results.
Filter parameters for narrowing down results.
Meta data for the dataProvider. Can be used to pass additional parameters to data provider methods.
If there is more than one
dataProvider, you should specify which one to use.TanStack Query’s
useQuery options.successNotification
OpenNotificationParams | false | ((data, params) => OpenNotificationParams | false)
Success notification configuration. Set to
false to disable.errorNotification
OpenNotificationParams | false | ((error, params) => OpenNotificationParams | false)
Error notification configuration. Set to
false to disable.Live/Realtime mode configuration.
Callback to handle live events.
Additional parameters for live queries.
Configuration for loading overtime behavior.
Return Values
Simplified result object.
TanStack Query’s
useQuery return object.Loading overtime information.
Examples
Basic Usage
With Pagination
With Sorting
With Filters
With Complex Filters (OR/AND)
Client-Side Pagination
With Query Options
Type Parameters
TQueryFnData- Result data type returned by the query function. ExtendsBaseRecord.TError- Custom error type that extendsHttpError.TData- Result data type returned by theselectfunction. ExtendsBaseRecord. Defaults toTQueryFnData.
FAQ
How do I disable the query?
How do I disable the query?
Use the
queryOptions.enabled parameter:How do I transform the data?
How do I transform the data?
Use the
queryOptions.select parameter:What's the difference between isLoading and isFetching?
What's the difference between isLoading and isFetching?
isLoadingistrueonly on the initial load (when there’s no cached data)isFetchingistruewhenever data is being fetched, including refetches