React and TypeScript
Nullable DOM ref
A ref initialized with null must be checked before accessing a mounted DOM node.
Formal Syntax & Structure
react syntaxreact
useRef<HTMLInputElement>(null)Working Example
Example Snippetreact
useRef<HTMLInputElement>(null)