Skip to content

Commit f54d0cd

Browse files
committed
Clarify startTransition callback wording
1 parent e144665 commit f54d0cd

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

‎src/content/reference/react/startTransition.md‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,17 @@ function TabContainer() {
5151

5252
* `startTransition` does not provide a way to track whether a Transition is pending. To show a pending indicator while the Transition is ongoing, you need [`useTransition`](/reference/react/useTransition) instead.
5353

54-
* The standalone `startTransition` function is not associated with a component.
55-
If the `action` throws an error or returns a rejected Promise, React reports
56-
the error as uncaught, and an Error Boundary does not handle it. In contrast,
57-
the `startTransition` function returned by
58-
[`useTransition`](/reference/react/useTransition#displaying-an-error-to-users-with-error-boundary)
59-
is associated with a component, so the nearest Error Boundary can handle
60-
these errors.
61-
6254
* You can wrap an update into a Transition only if you have access to the `set` function of that state. If you want to start a Transition in response to some prop or a custom Hook return value, try [`useDeferredValue`](/reference/react/useDeferredValue) instead.
6355

64-
* The function you pass to `startTransition` is called immediately, marking all state updates that happen while it executes as Transitions. If you try to perform state updates in a `setTimeout`, for example, they won't be marked as Transitions.
56+
* The function you pass to `startTransition` is called immediately, marking all
57+
state updates that happen while it executes as Transitions. If you try to
58+
perform state updates in a `setTimeout`, for example, they won't be marked as
59+
Transitions. If the function throws an error or returns a rejected Promise,
60+
React reports the error as uncaught. Unlike the `startTransition` function
61+
returned by
62+
[`useTransition`](/reference/react/useTransition#displaying-an-error-to-users-with-error-boundary),
63+
the standalone `startTransition` function is not associated with a component,
64+
so an Error Boundary does not handle these errors.
6565

6666
* You must wrap any state updates after any async requests in another `startTransition` to mark them as Transitions. This is a known limitation that we will fix in the future (see [Troubleshooting](/reference/react/useTransition#react-doesnt-treat-my-state-update-after-await-as-a-transition)).
6767

@@ -103,9 +103,11 @@ With a Transition, your UI stays responsive in the middle of a re-render. For ex
103103
The standalone `startTransition` and the function returned by
104104
[`useTransition`](/reference/react/useTransition) both mark state updates as
105105
Transitions. The standalone function does not provide the `isPending` flag and
106-
is not associated with a component, so an Error Boundary cannot handle errors
107-
from its Action. Unlike `useTransition`, the standalone `startTransition` is not
108-
a Hook and can be called outside components. [See Caveats.](#caveats)
106+
is not associated with a component. If the function passed to it throws an
107+
error or returns a rejected Promise, React reports the error as uncaught instead
108+
of allowing an Error Boundary to handle it. Unlike `useTransition`, the
109+
standalone `startTransition` is not a Hook and can be called outside components.
110+
[See Caveats.](#caveats)
109111

110112
[Learn about Transitions and see examples on the `useTransition` page.](/reference/react/useTransition)
111113

0 commit comments

Comments
 (0)