You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Composes `useInfiniteQuerySubscription` and `useInfiniteQueryState`, and is the primary hook. Automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store.
146
-
147
-
2.[`useInfiniteQuerySubscription`]()
148
-
149
-
- Returns a `refetch` function and accepts all hooks options. Automatically triggers refetches of data from an endpoint, and 'subscribes' the component to the cached data.
150
-
151
-
3.[`useInfiniteQueryState`]()
152
-
153
-
- Returns the query state and accepts `skip` and `selectFromResult`. Reads the request status and cached data from the Redux store.
- Composes `useInfiniteQuerySubscription` and `useInfiniteQueryState`, and is the primary hook. Automatically triggers fetches of data from an endpoint, 'subscribes' the component to the cached data, and reads the request status and cached data from the Redux store.
- Returns a `refetch` function and `fetchNext/PreviousPage` functions, and accepts all hooks options. Automatically triggers refetches of data from an endpoint, and 'subscribes' the component to the cached data.
- Returns the query state and accepts `skip` and `selectFromResult`. Reads the request status and cached data from the Redux store.
154
149
155
150
In practice, the standard `useInfiniteQuery`-based hooks such as `useGetPokemonInfiniteQuery` will be the primary hooks used in your application, but the other hooks are available for specific use cases.
156
151
157
152
### Query Hook Options
158
153
159
154
The query hooks expect two parameters: `(queryArg?, queryOptions?)`.
160
155
156
+
The `queryOptions` object accepts [all the same parameters as `useQuery`](./queries.mdx#query-hook-options), including `skip`, `selectFromResult`, and refetching/polling options.
157
+
161
158
Unlike normal query hooks, your `query` or `queryFn` callbacks will receive a "page param" value to generate the URL or make the request. By default, the `initialPageParam` value specified in the endpoint will be used to make the first request, and then your `getNext/PreviousPageParam` callbacks will be used to calculate further page params as you fetch forwards or backwards.
162
159
163
160
If you want to start from a different page param, you may override the `initialPageParam` by passing it as part of the hook options:
0 commit comments