logoalt Hacker News

recursive • 01/17/2025 • 1 reply • view on HN

Not technically, but they sure don't have to make it easy. Getting an element reference is clearly not the optimized-for use case. The docs even warn against it.

> Refs are an escape hatch. Manually manipulating another component’s DOM nodes can make your code fragile.

https://react.dev/learn/manipulating-the-dom-with-refs


Replies

robertoandred • 01/17/2025

Using HTML features doesn't have to mean manipulating another component's nodes.

➕ show 1 reply