React 19, the current version of Meta’s JavaScript library for rendering user interfaces, is now readily available in beta. The upgrade presents functions such as async functions in transitions and the capability to gain access to ref as a prop for function components.The React 19 beta
was unveiled April 25. A React 19 beta upgrade guide has actually been published.React 19 includes assistance for using async functions in shifts to deal with pending states, forms, mistakes, and positive updates instantly. Functions that use async transitions are called Actions. By building on top of Actions, React 19 introduces useOptimistic to handle optimistic updates and a brand-new hook, React.useActionState, to deal with common cases for Actions. Actions likewise are integrated with brand-new
React 19 includes all of the React Server Elements functions from the Canary channel, meaning libraries that deliver with Server Parts now can target React 19 as a peer dependency with react-server export condition for usage in frameworks that support the Full-stack React Architecture.
Other enhancements in React 19:
- A new API to read resources in render, called use, is presented.
- Mistake reporting has actually been enhanced for hydration errors in react-dom.
- Much better assistance is provided by async scripts; they can be rendered anywhere in a part tree.
- APIs are used for packing and preloading web browser resources for developing experiences not held by inefficient resource loading.
- Hydration has actually been enhanced to account for third-party scripts and web browser extensions.
- Mistake handling has actually been enhanced to eliminate duplication and offer alternatives for handling captured and uncaught mistakes.
- Assistance is being added for rendering file metadata tags in components natively.
can be rendered as a service provider instead of . - Cleanup functions can be returned from ref callbacks.
- An initialValue option has been added to useDeferredValue.
Copyright © 2024 IDG Communications, Inc.