useQuery

· abundance's blog


 1const {
 2  data,
 3  dataUpdatedAt,
 4  error,
 5  errorUpdatedAt,
 6  failureCount,
 7  failureReason,
 8  fetchStatus,
 9  isError,
10  isFetched,
11  isFetchedAfterMount,
12  isFetching,
13  isInitialLoading,
14  isLoading,
15  isLoadingError,
16  isPaused,
17  isPending,
18  isPlaceholderData,
19  isRefetchError,
20  isRefetching,
21  isStale,
22  isSuccess,
23  refetch,
24  status,
25} = useQuery(
26  {
27    queryKey,
28    queryFn,
29    gcTime,
30    enabled,
31    networkMode,
32    initialData,
33    initialDataUpdatedAt,
34    meta,
35    notifyOnChangeProps,
36    placeholderData,
37    queryKeyHashFn,
38    refetchInterval,
39    refetchIntervalInBackground,
40    refetchOnMount,
41    refetchOnReconnect,
42    refetchOnWindowFocus,
43    retry,
44    retryOnMount,
45    retryDelay,
46    select,
47    staleTime,
48    structuralSharing,
49    throwOnError,
50  },
51  queryClient,
52)

Options

Returns