use()

The React 19 API that reads a value from a Promise or a context, and unlike hooks may be called inside conditions and loops.

In more detail

use(promise) suspends the component until the promise settles, showing the nearest Suspense fallback, then returns the resolved value; a rejection goes to the nearest error boundary. use(Context) works like useContext but can be called after an early return. It must still be called during rendering of a component or hook.

Example

const user = use(userPromise);

Related terms

Taught in

References