In the past there has been a lot of confusion around the
ref attribute in React. The attribute makes it possible to reference a DOM node in order to access it and to interact with it. This article should give some clarification around the
ref attribute in React. It shows you how you can use it, when you should use it and where it can be used.
On a side note: Don’t mistake the
ref attribute with the
this.refs object. The latter was used in React in the past. There you would have used a string over a callback function to reference a DOM node. It was deprecated in favor of the
An input element is the perfect example to showcase the
... read the whole story at www.robinwieruch.de.