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
Copy file name to clipboardExpand all lines: packages/toolkit/src/query/react/buildHooks.ts
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -918,6 +918,16 @@ export type UseInfiniteQuery<
918
918
'fetchNextPage'|'fetchPreviousPage'
919
919
>
920
920
921
+
/**
922
+
* A React hook that reads the request status and cached data from the Redux store. The component will re-render as the loading status changes and the data becomes available.
923
+
*
924
+
* Note that this hook does not trigger fetching new data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQuerySubscription`](#useinfinitequerysubscription).
925
+
*
926
+
* #### Features
927
+
*
928
+
* - Returns the latest request status and cached data from the Redux store
929
+
* - Re-renders as the request status changes and data becomes available
@@ -941,6 +951,20 @@ export type TypedUseInfiniteQueryState<
941
951
>
942
952
>
943
953
954
+
/**
955
+
* A React hook that automatically triggers fetches of data from an endpoint, and 'subscribes' the component to the cached data. Additionally, it will cache multiple "pages" worth of responses within a single cache entry, and allows fetching more pages forwards and backwards from the current cached pages.
956
+
*
957
+
* The query arg is used as a cache key. Changing the query arg will tell the hook to re-fetch the data if it does not exist in the cache already.
958
+
*
959
+
* Note that this hook does not return a request status or cached data. For that use-case, see [`useInfiniteQuery`](#useinfinitequery) or [`useInfiniteQueryState`](#useinfinitequerystate).
960
+
*
961
+
* #### Features
962
+
*
963
+
* - Automatically triggers requests to retrieve data based on the hook argument and whether cached data exists by default
964
+
* - 'Subscribes' the component to keep cached data in the store, and 'unsubscribes' when the component unmounts
965
+
* - Caches multiple pages worth of responses, and provides methods to trigger more page fetches forwards and backwards
966
+
* - Accepts polling/re-fetching options to trigger automatic re-fetches when the corresponding criteria is met
0 commit comments