Skip to content

Commit 64dec9e

Browse files
authored
docs: fix event pooling info (TanStack#2174)
* Fix React event pooling link * Update mutations.md
1 parent da85602 commit 64dec9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/src/pages/guides/mutations.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ In the example above, you also saw that you can pass variables to your mutations
5353

5454
Even with just variables, mutations aren't all that special, but when used with the `onSuccess` option, the [Query Client's `invalidateQueries` method](../reference/QueryClient#queryclientinvalidatequeries) and the [Query Client's `setQueryData` method](../reference/QueryClient#queryclientsetquerydata), mutations become a very powerful tool.
5555

56-
> IMPORTANT: The `mutate` function is an asynchronous function, which means you cannot use it directly 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).
56+
> IMPORTANT: The `mutate` function is an asynchronous function, which means you cannot use it directly in an event callback in **React 16 and earlier**. 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/legacy-event-pooling.html).
5757
5858
```js
59-
// This will not work
59+
// This will not work in React 16 and earlier
6060
const CreateTodo = () => {
6161
const mutation = useMutation(event => {
6262
event.preventDefault()

0 commit comments

Comments
 (0)