React 19 brings async functions, server components/actions and support for custom elements
Dec 6, 2024 at 4:50 PM

React 19 brings async functions, server components/actions and support for custom elements

The Meta team has announced the release of React 19, introducing several significant new features and enhancements. One of the key updates is the support for using async functions in transitions, simplifying the handling of pending states, errors, forms, and optimistic updates. This is complemented by the introduction of useOptimistic and a new hook, React.useActionState, to streamline common cases for Actions.

React 19 also integrates Actions with new `` features in react-dom, offering a useFormStatus hook that allows reading the status of the parent form as if it were a Context provider. A new API, use, has been introduced to facilitate reading resources during rendering. For static site generation, react-dom/static now includes prerender and prerenderToNodeStream APIs.

Server Components and Actions are now part of React 19, enabling pre-rendering of components and allowing Client Components to execute async functions on the server. Additionally, function components can now access ref as a prop. Error reporting has been enhanced, particularly for hydration errors in react-dom.

React 19 brings full support for custom elements, passing all tests on Custom Elements Everywhere. Other features include the introduction of `` as a provider, support for returning cleanup functions from ref callbacks, native rendering of document metadata tags, async scripts, resource preloading, and improved error reporting.

Dec 6, 2024 by Paul

React iconReact
  75
  • ...

React is a JavaScript library designed for building user interfaces, known for its modular system and efficient Virtual DOM. With a high rating of 4.8, React is a popular choice for developers seeking to create dynamic and responsive web applications. It stands alongside alternatives like Vue.js, Angular, and Astro Web Framework, each offering unique features for diverse development needs.

No comments so far, maybe you want to be first?
Gu