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
@@ -106,6 +110,8 @@ Each builder hook accepts the same initial parameters:
106
110
107
111
## `useQuery`
108
112
113
+
This hook is a typed wrapper over [`useSWR`][swr-api].
114
+
109
115
```ts
110
116
const useQuery =createQueryHook(/* ... */);
111
117
@@ -161,6 +167,8 @@ function useQuery(path, ...[init, config]) {
161
167
162
168
## `useImmutable`
163
169
170
+
This hook has the same contracts as `useQuery`. However, instead of wrapping [`useSWR`][swr-api], it wraps `useSWRImmutable`. This immutable hook [disables automatic revalidations][swr-disable-auto-revalidate] but is otherwise identical to `useSWR`.
This hook has the same contracts as `useQuery`. However, instead of wrapping [`useSWR`][swr-api], it wraps `useSWRImmutable`. This immutable hook [disables automatic revalidations][swr-disable-auto-revalidate] but is otherwise identical to `useSWR`.
175
-
176
182
### Parameters
177
183
178
184
Identical to `useQuery`[parameters](#parameters-1).
@@ -183,6 +189,8 @@ Identical to `useQuery` [returns](#returns-1).
183
189
184
190
## `useInfinite`
185
191
192
+
This hook is a typed wrapper over [`useSWRInfinite`][swr-infinite].
193
+
186
194
```ts
187
195
const useInfinite =createInfiniteHook(/* ... */);
188
196
@@ -241,9 +249,10 @@ This function is similar to the [`getKey`][swr-infinite-options] parameter accep
241
249
-`undefined` (if on the first page).
242
250
- The fetched response for the last page retrieved.
243
251
244
-
#### Should Return
252
+
#### Returns
245
253
246
254
-[Fetch options][oai-fetch-options] for the next page to load.
`useMutate` is a wrapper around SWR's [global mutate][swr-global-mutate] function. It provides a type-safe mechanism for updating and revalidating SWR's client-side cache for specific endpoints.
329
332
330
333
Like global mutate, this mutate wrapper accepts three parameters: `key`, `data`, and `options`. The latter two parameters are identical to those in _bound mutate_. `key` can be either a path alone, or a path with fetch options.
331
334
332
335
The level of specificity used when defining the key will determine which cached requests are updated. If only a path is provided, any cached request using that path will be updated. If fetch options are included in the key, the [`compare`](#compare) function will determine if a cached request's fetch options match the key's fetch options.
0 commit comments