What is useRef Hook in React ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is useRef Hook in React ?

Some one tell me what is the use of useRef hook

13th Jun 2020, 4:03 AM
Sai Narasimha
Sai Narasimha - avatar
1 Answer
+ 5
There are two main uses of useRef that are explained in the following sections: Accessing the DOM nodes or React elements and keeping a mutable variable. Here is an example of useRef accessing an input element https://code.sololearn.com/WvBFZ059AhjL/?ref=app Here is an example of useRef as mutable variable. https://code.sololearn.com/WW9Q8vDDfa0q/?ref=app
13th Jun 2020, 4:40 AM
Calviղ
Calviղ - avatar