Skip to content

Commit 367831d

Browse files
authored
Update use.md with caution on bypassing use
Add warning about bypassing `use` and its effects on React Suspense.
1 parent ff82da9 commit 367831d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • src/content/reference/react

src/content/reference/react/use.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,9 @@ const value = use(promise);
678678
```js
679679
// ✅ Pass the promise to `use` and let React track the promise
680680
const value = use(promise);
681+
```
682+
683+
Bypassing `use` this way can break React Suspense optimizations and Suspense features for React DevTools. You can `use(promise)` conditionally, but don't conditionally `use(promise)` based on the promise itself.
681684
682685
</Pitfall>
683686

0 commit comments

Comments
 (0)