The parameters for the hook.
Optional
apiAdditional options to pass to the API client.
Optional
params?: Record<string, any>Dynamic query parameters for the API request.
Optional
queryAdditional options to configure the useQuery
The resource path and any static parameters for the API request.
The result of the useQuery
hook.
A hook that helps you fetch a list of resources.
The hook uses
useQuery
from@tanstack/react-query
to fetch data and cache it. It accepts various query options and performs an API request to fetch a list of resources based on the providedresource
andparams
. The hook supports additional query parameters and custom API client parameters.If a custom
queryFn
is provided, it will be used to perform the query; otherwise, the default API client method will be used. ThequeryKey
is constructed based on the resource path and additional parameters to ensure proper caching and refetching.Example