React 19 use() with Suspense
Explain the React 19 `use()` hook. How does it differ from fetching in useEffect?
Answers use simple, clear English.
Quick interview answer
`use(promise)` reads a promise during render and suspends until resolved — requiring a Suspense boundary. `use(context)` can read context conditionally. Unlike useEffect fetch (setState after mount), use integrates with Suspense/SSR streaming and avoids waterfalls when promises are started earlier.
Detailed answer
`use(promise)` reads a promise during render and suspends until resolved — requiring a Suspense boundary. `use(context)` can read context conditionally. Unlike useEffect fetch (setState after mount), use integrates with Suspense/SSR streaming and avoids waterfalls when promises are started earlier. Critical: don't create a new promise every render or you'll suspend forever.
Real example & use case
Parent starts fetchUser(id) once; child calls use(userPromise) under <Suspense>.
Pros & cons
Pros: Suspense-native data reading. Cons: promise identity must be stable; need error boundaries.