Problem Statement
What is the purpose of useRef() hook?
Explanation
useRef() creates a mutable reference that persists across renders. It is commonly used to access DOM elements directly or store mutable values without causing re-renders.
Code Solution
SolutionRead Only
const inputRef = useRef(null);
<input ref={inputRef} />;