Refs in React is a shortcut way to access a specific DOM node or a React component.
There are two types of refs in react, string refs and callback refs.
In callback refs we set the ref attribute to a function which receives the component/element reference as an argument and sets the reference.
In this example let us see how to use a callback ref to read the text from a textbox and display it on the page.
There are two types of refs in react, string refs and callback refs.
In callback refs we set the ref attribute to a function which receives the component/element reference as an argument and sets the reference.
In this example let us see how to use a callback ref to read the text from a textbox and display it on the page.