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
{isFetching ?'Loading more todos...':'Load more todos'}
229
229
</button>
230
230
)}
231
231
</>
232
-
)
232
+
):null
233
233
}
234
234
```
235
235
236
236
To prevent you from managing the loading state of `refetch` manually (since `isLoading` will remain false when `refetch` is called), React Query exposes an `isFetching` variable. It's the same as `isLoading`, but only reflects the state of the actual fetch operation for the query.
237
237
238
+
### Manual Querying
239
+
240
+
If you ever want to disable a query from automatically running when the query or variables change, you can use the `manual = true` option. When `manual` is set to true, queries will not automatically refetch due to changes to their query or variables.
manual:!userID, // Don't auto fetch if there is no userID
281
+
variables: {
282
+
userID,
283
+
},
284
+
}
285
+
)
286
+
287
+
return isLoading ? (
288
+
<span>Loading...</span>
289
+
) : error ? (
290
+
<span>Error: {error.message}</span>
291
+
) : data ? (
292
+
<>
293
+
<ul>
294
+
{data.map(todo=> (
295
+
<li key={todo.id}>{todo.title}</li>
296
+
))}
297
+
</ul>
298
+
</>
299
+
) :null
300
+
}
301
+
```
302
+
238
303
### Retries
239
304
240
305
When a `useQuery` query fails (the function throws an error), React Query will automatically retry the query if that query's request has not reached the max number of consecutive retries (defaults to `3`).
0 commit comments