Async functions and state management
Optimistic updates with useOptimistic [Actions]
State management with useActionState
Streamlining form handling
Simplifying form state with useFormStatus
Suspense and data fetching with React’s Use API
React server components
Async functions and state management
React 19 introduces useTransition, a powerful hook that simplifies managing asynchronous operations within your components. This allows you to use async functions directly for data mutations and smoother state updates.
Optimistic updates with useOptimistic [Actions]
Actions support the new useOptimistic hook, enabling you to provide users with instant feedback while their requests are being processed.
State management with useActionState
The useActionState hook simplifies state management based on form action results. It takes an Action function and returns a wrapped version. When called, the wrapped Action provides the last result as data and the current state as pending.
Streamlining form handling
React 19 introduces new functionalities for the <form> component in react-dom. You can now assign functions to the action and formAction props of <form> elements. By default, functions linked to the action prop use Actions and automatically reset the form after submission.
Simplifying form state with useFormStatus
In design systems, components often need to access information about the <form> they belong to without passing props through multiple layers. While Context can achieve this, React 19 simplifies the process with a new hook called useFormStatus.
Suspense and data fetching with React’s Use API
React 19 introduces the use API for reading resources during rendering. This API lets you handle promises directly in your components, enabling React to suspend rendering until the promise resolves. It’s particularly useful for data fetching, ensuring data is available before rendering.
React server components
React 19 has unveiled a new feature called server components, which allows for the prerendering of components. This rendering can take place either during the build process on a CI server or dynamically with each request on a web server.