Action (React)
In React 19, an async function run inside a transition, typically to submit data, with pending state, errors and optimistic updates handled by React.
In more detail
You can pass an Action to startTransition, to useActionState, or directly to the action prop of a form or button. While it runs, isPending is true; if it throws, the nearest error boundary or your returned error state handles it.
Related terms
- useActionState — The React hook that wraps an Action and returns its latest result, a function to trigger it, and an isPending flag.
- transition — A React state update marked as not urgent, which React may interrupt or delay so urgent input stays responsive.
- useOptimistic — The React hook that shows a temporary optimistic value while an Action is pending, then returns to the real state when it settles.
- Server Functions — Async functions marked with "use server" that run on the server but can be called from client components, for example as a form action.
Taught in
- Complex State with useReducer: State Machines And Action Types — React 19 & Modern Component Architecture
- Avoiding Effect Antipatterns: Derived State And Events — React 19 & Modern Component Architecture
- useImperativeHandle: Controlled Ref Forwarding Boundaries — React 19 & Modern Component Architecture
- useContext in Depth: Scoping, Consumer Subscription Costs — React 19 & Modern Component Architecture
- Slot Patterns And Headless UI Architecture in React — React 19 & Modern Component Architecture
- Custom Hook Composition: Encapsulating Reactive Logic — React 19 & Modern Component Architecture
- useId: Generating Stable Accessible Form Element Identifiers — React 19 & Modern Component Architecture
- useTransition: Non-Blocking State Updates for Fluid UI — React 19 & Modern Component Architecture
- useActionState: Async Action Handlers And Pending States — React 19 & Modern Component Architecture
- useOptimistic: Instantaneous UI Updates with Rollback — React 19 & Modern Component Architecture