react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

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

Open prittoruban opened this issue 1 year ago • 2 comments

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

prittoruban avatar Jul 11 '24 20:07 prittoruban

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

vercel[bot] avatar Jul 11 '24 20:07 vercel[bot]

Size changes

📦 Next.js Bundle Analysis for react-dev

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

github-actions[bot] avatar Jul 11 '24 20:07 github-actions[bot]