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
+9-13Lines changed: 9 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,14 +53,7 @@ function TabContainer() {
53
53
54
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.
55
55
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 because the standalone `startTransition`
61
-
function is not associated with a component. [Learn how to display errors
* 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.
64
57
65
58
* 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)).
66
59
@@ -99,11 +92,14 @@ With a Transition, your UI stays responsive in the middle of a re-render. For ex
99
92
100
93
<Note>
101
94
102
-
The standalone `startTransition` and the function returned by
103
-
[`useTransition`](/reference/react/useTransition) both mark state updates as
104
-
Transitions. Unlike `useTransition`, the standalone function does not provide
105
-
the `isPending` flag. It is not a Hook, so you can call it outside components.
106
-
[See Caveats.](#caveats)
95
+
`startTransition` is very similar to
96
+
[`useTransition`](/reference/react/useTransition), except that it does not
97
+
provide the `isPending` flag to track whether a Transition is ongoing. The
98
+
standalone function is also not associated with a component, so if the function
99
+
passed to it throws an error or returns a rejected Promise, React reports the
100
+
error as uncaught. You can call `startTransition` when `useTransition` is not
101
+
available. For example, `startTransition` works outside components, such as from
102
+
a data library.
107
103
108
104
[Learn about Transitions and see examples on the `useTransition` page.](/reference/react/useTransition)
0 commit comments