ReactuseRef Hook

useRef is a React Hook that returns a mutable object which persists across renders. It's commonly used to reference DOM elements or store values that don’t trigger re-renders.

import React, { useRef } from 'react';

function FocusInput() {
  const inputRef = useRef(null);

  const handleClick = () => {
    inputRef.current.focus();
  };

  return (
    <div>
      <input ref={inputRef} type=\"text\" />
      <button onClick={handleClick}>Focus Input</button>
    </div>
  );
}