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
Copy file name to clipboardExpand all lines: src/content/reference/react/startTransition.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,17 +51,17 @@ function TabContainer() {
51
51
52
52
*`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.
53
53
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,
is associated with a component, so the nearest Error Boundary can handle
60
-
these errors.
61
-
62
54
* 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.
63
55
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
the standalone `startTransition` function is not associated with a component,
64
+
so an Error Boundary does not handle these errors.
65
65
66
66
* 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)).
67
67
@@ -103,9 +103,11 @@ With a Transition, your UI stays responsive in the middle of a re-render. For ex
103
103
The standalone `startTransition` and the function returned by
104
104
[`useTransition`](/reference/react/useTransition) both mark state updates as
105
105
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)
109
111
110
112
[Learn about Transitions and see examples on the `useTransition` page.](/reference/react/useTransition)
0 commit comments