Skip to content

Commit 953c869

Browse files
committed
2 parents 15b9c9b + 7bc83d0 commit 953c869

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

docs/src/pages/docs/guides/mutations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const CreateTodo = () => {
7878
}
7979
```
8080

81-
Even with just variables, mutations aren't all that special, but when used with the `onSuccess` option, the [Query Cache's `invalidateQueries` method](#querycacheinvalidatequeries) and the [Query Cache's `setQueryData` method](#querycachesetquerydata), mutations become a very powerful tool.
81+
Even with just variables, mutations aren't all that special, but when used with the `onSuccess` option, the [Query Cache's `invalidateQueries` method](../api#querycacheinvalidatequeries) and the [Query Cache's `setQueryData` method](../api/#querycachesetquerydata), mutations become a very powerful tool.
8282

8383
Note that since version 1.1.0, the `mutate` function is no longer called synchronously so you cannot use it in an event callback. If you need to access the event in `onSubmit` you need to wrap `mutate` in another function. This is due to [React event pooling](https://reactjs.org/docs/events.html#event-pooling).
8484

docs/src/pages/docs/guides/prefetching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ If a prefetched query is rendered after the `staleTime` for a prefetched query,
2222

2323
## Manually Priming a Query
2424

25-
Alternatively, if you already have the data for your query synchronously available, you don't need to prefetch it. You can just use the [Query Cache's `setQueryData` method](#querycachesetquerydata) to directly add or update a query's cached result.
25+
Alternatively, if you already have the data for your query synchronously available, you don't need to prefetch it. You can just use the [Query Cache's `setQueryData` method](../api/#querycachesetquerydata) to directly add or update a query's cached result.
2626

2727
```js
2828
import { queryCache } from 'react-query'

docs/src/pages/docs/guides/suspense.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ import { ErrorBoundary } from "react-error-boundary";
6464

6565
## Fetch-on-render vs Render-as-you-fetch
6666

67-
Out of the box, React Query in `suspense` mode works really well as a **Fetch-on-render** solution with no additional configuration. This means that when your components attempt to mount, they will trigger query fetching and suspend, but only once you have imported them and mounted them. If you want to take it to the next level and implement a **Render-as-you-fetch** model, we recommend implementing [Prefetching](#prefetching) on routing callbacks and/or user interactions events to start loading queries before they are mounted and hopefully even before you start importing or mounting their parent components.
67+
Out of the box, React Query in `suspense` mode works really well as a **Fetch-on-render** solution with no additional configuration. This means that when your components attempt to mount, they will trigger query fetching and suspend, but only once you have imported them and mounted them. If you want to take it to the next level and implement a **Render-as-you-fetch** model, we recommend implementing [Prefetching](./prefetching) on routing callbacks and/or user interactions events to start loading queries before they are mounted and hopefully even before you start importing or mounting their parent components.

docs/src/pages/docs/guides/updates-from-mutation-responses.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: updates-from-mutation-responses
33
title: Updates from Mutation Responses
44
---
55

6-
When dealing with mutations that **update** objects on the server, it's common for the new object to be automatically returned in the response of the mutation. Instead of refetching any queries for that item and wasting a network call for data we already have, we can take advantage of the object returned by the mutation function and update the existing query with the new data immediately using the [Query Cache's `setQueryData`](#querycachesetquerydata) method:
6+
When dealing with mutations that **update** objects on the server, it's common for the new object to be automatically returned in the response of the mutation. Instead of refetching any queries for that item and wasting a network call for data we already have, we can take advantage of the object returned by the mutation function and update the existing query with the new data immediately using the [Query Cache's `setQueryData`](../api#querycachesetquerydata) method:
77

88
```js
99
const [mutate] = useMutation(editTodo, {
@@ -25,7 +25,7 @@ create a custom hook like this:
2525

2626
```js
2727
const useMutateTodo = () => {
28-
return useMutate(editTodo, {
28+
return useMutation(editTodo, {
2929
// Notice the second argument is the variables object that the `mutate` function receives
3030
onSuccess: (data, variables) => {
3131
queryCache.setQueryData(['todo', { id: variables.id }], data)

0 commit comments

Comments
 (0)