API · React 19
use
Read a resource, inline
use() reads a value from a Promise or a Context from within the render. If the resource isn't ready yet, the component suspends — leaving the nearest Suspense to handle the wait.
One API, two cases
use(promise) waits for the result or suspends. use(context) is like useContext but can be called conditionally — something useContext doesn't allow.
Replaces old patterns
Instead of useState + useEffect + setData to load, you pass the promise to the component and use() consumes it. More declarative, fewer intermediate states.
Common pitfalls
- 01use() can be called conditionally — unlike hooks, it's not bound to call order rules.
- 02If the promise rejects, the nearest Error Boundary catches it — make sure one exists.
- 03use() for Context is an alternative to useContext, but useContext is clearer for most cases.
Was this helpful?
Sign in to give feedback
