opendevs
opendevs logo
CoursesInterviewsBlogs

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.
Lists and Keys
Loading video...

Refs & the DOM (in Hindi)

Concepts

    1

    Refs & the DOM (in Hindi)
    Refs & the DOM (in Hindi)

    2

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

    3

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

    4

    Refs & the DOM - Implementation - Part 3 (in Hindi)
    Refs & the DOM - Implementation - Part 3 (in Hindi)
Watch the full video to earn  3  DevCoin image

Quizzes


1

Uncontrolled components handle data by React?

Question 1 of 3
1  DevCoin image   per question
2

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  DevCoin image   per question
3

Is ref property generally available in HTML elements also?

Question 1 of 3
1  DevCoin image   per question

Coding Questions


Focus the Input Field

easy

1  DevCoin image
Hide the div

easy

1  DevCoin image
Forward Ref

medium

2  DevCoin image
opendevs logo
CoursesFAQsContact UsPrivacy PolicyTerms Of Service
Copyright © 2023 opendevs
Learn ● Develop ● Ace
All illustrations by Storyset