arrow_backBACK TO DRILLS
Blue BeltuserefPREMIUM
useRef Typed as MutableRefObject<undefined> Causes Type Error When Passed to DOM Ref Prop
A developer calls useRef() with no argument and passes the result to a div's ref prop in a TypeScript file.
REACT_MODULE // 0x42
const divRef = useRef();
return <div ref={divRef} />;Why does TypeScript reject this, and what is the correct way to declare the ref?