Lint and compiler
refs
Use refs for imperative access outside render. Read DOM nodes in event handlers after commit, not to compute render output.
Formal Syntax & Structure
react syntaxreact
react-hooks/refsWorking Example
Example Snippetreact
import {useRef} from 'react';export default function App(){const ref=useRef(null);return <><input ref={ref} aria-label='Tool'/><button onClick={()=>ref.current?.focus()}>Focus</button></>}