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
The function passed to `startTransition` is called an Action. If the Action is async, React will wait for the async update to finish before transitioning the UI to the updated state:
// is needed after any async requests. See Caveats.
79
-
startTransition(() => {
80
-
setData(data);
81
-
});
82
-
});
83
-
}
84
-
// ...
85
-
}
86
-
```
87
-
88
67
<Note>
89
-
#### By convention, functions inside `startTransition` are called "Actions". {/*by-convention-functions-that-call-transitions-are-called-actions*/}
68
+
#### Functions called in `startTransition` are called "Actions". {/*functions-called-in-starttransition-are-called-actions*/}
90
69
91
-
The function passed to `startTransition` is called an "Action". By convention, any callback called inside `startTransition` (such as a callback prop) include the "Action" suffix.
70
+
The function passed to `startTransition` is called an "Action". By convention, any callback called inside `startTransition` (such as a callback prop) are named `action` or include the "Action" suffix:
92
71
93
-
Transitions can include multiple Actions, such as an Action to update a local component, and another Action to navigate to the next route. Transitions support:
-**Pending states**: Actions provide a pending state that starts at the beginning of the Transition and automatically resets when the final state update is committed.
96
-
-**Optimistic updates**: Actions support the new [`useOptimistic`](#new-hook-optimistic-updates) hook so you can show users instant feedback while the Action is in progress.
97
-
-**Error handling**: Actions provide error handling so you can display Error Boundaries when an Action fails, and revert optimistic updates to their original value automatically.
98
-
-**Forms**: `<form>` elements now support passing functions to the `action` and `formAction` props. Passing functions to the `action` props use Actions by default and reset the form automatically after submission.
0 commit comments