Ref a DOM Element

In this lesson, we'll learn how to interact with DOM nodes in React.

Why interact with the DOM?

Sometimes you need to interact with your DOM nodes in React. The ref attribute gives you access to a node in your elements. That is usually an anti pattern in React, because you should use its declarative way of doing things and its unidirectional data flow. We learned about it when we introduced the first search input field, but there are ...

Access this course and 1400+ top-rated courses and projects.