Skip to content

Commit fb6c0d2

Browse files
authored
Update caveats for useTransition documentation
Clarify conditions for marking state updates as Transitions with `startTransition`.
1 parent 6be2b02 commit fb6c0d2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/content/reference/react/useTransition.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ function SubmitButton({ submitAction }) {
105105

106106
* `useTransition` is a Hook, so it can only be called inside components or custom Hooks. If you need to start a Transition somewhere else (for example, from a data library), call the standalone [`startTransition`](/reference/react/startTransition) instead.
107107

108-
* 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 value, try [`useDeferredValue`](/reference/react/useDeferredValue) instead.
108+
* A state update is marked as a Transition only if its setter runs inside `startTransition`, directly or through a callback. If you only have the updated value from a prop or custom Hook, use
109+
[`useDeferredValue`](/reference/react/useDeferredValue) instead.
109110

110111
* 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.
111112

0 commit comments

Comments
 (0)