reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
11k stars 7.51k forks source link

Improve useRef documentation to avoid re-creating ref contents and null checks #7055

Open PrittoRuban opened 2 months ago

PrittoRuban commented 2 months ago

Introduced a more robust solution using useState for stable reference initialization.

This approach has several advantages:

  1. It avoids re-creating the video player instance on every render.
  2. It provides a stable reference that does not change across renders.

7041

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
19-react-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2024 8:39pm
react-dev ✅ Ready (Inspect) Visit Preview Jul 11, 2024 8:39pm
github-actions[bot] commented 2 months ago

Size changes

## 📦 Next.js Bundle Analysis for react-dev This analysis was generated by the [Next.js Bundle Analysis action](https://github.com/hashicorp/nextjs-bundle-analysis). 🤖 This PR introduced no changes to the JavaScript bundle! 🙌