9.9 C
New York
Saturday, April 27, 2024

React 19 builds on async transitions


React 19, the newest model of Meta’s JavaScript library for rendering consumer interfaces, is now obtainable in beta. The replace introduces options equivalent to async capabilities in transitions and the flexibility to entry ref as a prop for operate parts.

The React 19 beta was unveiled April 25. A React 19 beta improve information has been revealed.

React 19 provides assist for utilizing async capabilities in transitions to deal with pending states, types, errors, and optimistic updates mechanically. Capabilities that use async transitions are referred to as Actions. By constructing on high of Actions, React 19 introduces useOptimistic to handle optimistic updates and a brand new hook, React.useActionState, to deal with widespread instances for Actions. Actions are also built-in with new <type> options for react-dom in React 19.

React 19 contains all the React Server Parts options from the Canary channel, which means libraries that ship with Server Parts now can goal React 19 as a peer dependency with react-server export situation to be used in frameworks that assist the Full-stack React Structure.

Different enhancements in React 19:

  • A brand new API to learn assets in render, referred to as use, is launched.
  • Error reporting has been improved for hydration errors in react-dom.
  • Higher assist is obtainable by async scripts; they are often rendered wherever in a part tree.
  • APIs are supplied for loading and preloading browser assets for constructing experiences not held by inefficient useful resource loading.
  • Hydration has been improved to account for third-party scripts and browser extensions.
  • Error dealing with has been improved to take away duplication and supply choices for dealing with caught and uncaught errors.
  • Assist is being added for rendering doc metadata tags in parts natively.
  • <Context> may be rendered as a supplier as an alternative of <Context.Supplier>.
  • Cleanup capabilities may be returned from ref callbacks.
  • An initialValue possibility has been added to useDeferredValue.

Copyright © 2024 IDG Communications, Inc.



Supply hyperlink

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles