Refs in React
Refs is the shorthand used for references in React. It is similar to keys in React. It is an attribute which makes it possible to store a reference to particular DOM nodes or React elements. It provides a way to access React DOM nodes or React elements and how to interact with it. It is used when we want to change the value of a child component, without making the use of props.
Loading video...
Refs & the DOM (in Hindi)
Concepts
1

Refs & the DOM (in Hindi)
2

Refs & the DOM - Implementation - Part 1 (in Hindi)
3

Refs & the DOM - Implementation - Part 2 (in Hindi)
4

Refs & the DOM - Implementation - Part 3 (in Hindi)
Watch the full video to earn 3
Quizzes
1
Uncontrolled components handle data by React?
Question 1 of 3
1
per question2
What will be the value in console on the first render of this code?
import {useRef} from 'react'; export default MyComponent { const myRef = useRef(); console.log(myRef); // <--- Output of this line return ( <p id="tagline" ref={myRef}>Hello there from Dev11</p> ) }
Question 1 of 3
1
per question3
Is ref
property generally available in HTML elements also?
Question 1 of 3
1
per question