const textInputRef = useRef();
useEffect(() => {
if (textInputRef && textInputRef.current) {
textInputRef.current?.focus(); // property 'focus' does not exist on type 'never'
}
}, []);
return (
<input ref={textInputRef} />
)
The textInputRef.current?.focus()
line is throwing property 'focus' does not exist on type 'never'
I'm on React 16.13.1, typescript 4.0.2 using hooks and function components