Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarify error handling for standalone startTransition (#8648)
* Clarify standalone startTransition error handling

* Polish startTransition error handling docs

* Describe startTransition differences neutrally

* Clarify startTransition callback wording

* Remove repeated startTransition caveat

* Preserve existing startTransition guidance

* Preserve useTransition error guidance

* Update src/content/reference/react/useTransition.md

Co-authored-by: Sebastian "Sebbie" Silbermann <silbermann.sebastian@gmail.com>

* Clarify standalone startTransition error reporting

---------

Co-authored-by: Sebastian "Sebbie" Silbermann <silbermann.sebastian@gmail.com>
  • Loading branch information
aurorascharff and eps1lon authored Sep 10, 2026
commit 8efce7853d0fc59e615ed1c253799cf1798b8428
2 changes: 1 addition & 1 deletion src/content/reference/react/startTransition.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ With a Transition, your UI stays responsive in the middle of a re-render. For ex

<Note>

`startTransition` is very similar to [`useTransition`](/reference/react/useTransition), except that it does not provide the `isPending` flag to track whether a Transition is ongoing. You can call `startTransition` when `useTransition` is not available. For example, `startTransition` works outside components, such as from a data library.
`startTransition` is very similar to [`useTransition`](/reference/react/useTransition), except that it does not provide the `isPending` flag to track whether a Transition is ongoing. The standalone function is also not associated with a component, so if the function passed to it throws an error or returns a rejected Promise, React reports the error with [`reportError`](https://developer.mozilla.org/en-US/docs/Web/API/Window/reportError). You can call `startTransition` when `useTransition` is not available. For example, `startTransition` works outside components, such as from a data library.

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

Expand Down
8 changes: 6 additions & 2 deletions src/content/reference/react/useTransition.md
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ main {
### Displaying an error to users with an error boundary {/*displaying-an-error-to-users-with-error-boundary*/}
If a function passed to `startTransition` throws an error, you can display an error to your user with an [error boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary). To use an error boundary, wrap the component where you are calling the `useTransition` in an error boundary. Once the function passed to `startTransition` errors, the fallback for the error boundary will be displayed.
If a function passed to `startTransition` throws an error or returns a rejected Promise, you can display an error to your user with an [error boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary). To use an error boundary, wrap the component where you are calling the `useTransition` in an error boundary. Once the function passed to `startTransition` errors, the fallback for the error boundary will be displayed.
<Sandpack>
Expand Down Expand Up @@ -1738,7 +1738,11 @@ This is a JavaScript limitation due to React losing the scope of the async conte
### I want to call `useTransition` from outside a component {/*i-want-to-call-usetransition-from-outside-a-component*/}
You can't call `useTransition` outside a component because it's a Hook. In this case, use the standalone [`startTransition`](/reference/react/startTransition) method instead. It works the same way, but it doesn't provide the `isPending` indicator.
You can't call `useTransition` outside a component because it's a Hook. In this
case, the standalone [`startTransition`](/reference/react/startTransition)
function can mark state updates as Transitions. It does not provide the
`isPending` flag. Because the standalone function is not associated with a
component, an Error Boundary cannot handle errors from its Transition.
---
Expand Down