DEV Community

New React 19 Hook: use()

With use(), the way we handle asynchronous data in React components has been drastically simplified.

💡 Before vs. Now: Comparison with Examples

Before React 19
Handling asynchronous data required the use of useEffect and useState, leading to more verbose code:

Image description

With React 19 and the use() Hook
Now it's possible to handle Promises directly in the component body in a more declarative way:

Image description

By using use(), React pauses the component rendering until the Promise is resolved, directly integrating with the loading management of the Suspense API.

Top comments (0)