Используйте Ref в REACT TypeScript
const inputRef = React.useRef<HTMLInputElement | null>(null);
Obedient Oyster
const inputRef = React.useRef<HTMLInputElement | null>(null);
const useCustom = (): [
RefObject<HTMLDivElement>,
(node: HTMLDivElement) => void
] => {
const ref = useRef<HTMLDivElement | null>(null);
const setRef = useCallback((node: unknown) => {
ref.current = node;
}, []);
return [ref, setRef];
};