Skip to content

Instantly share code, notes, and snippets.

@jrwebdev
Created February 13, 2019 05:48
Show Gist options
  • Save jrwebdev/0b7ba1f0bd0da2dcdecdd1112c0f2787 to your computer and use it in GitHub Desktop.
Save jrwebdev/0b7ba1f0bd0da2dcdecdd1112c0f2787 to your computer and use it in GitHub Desktop.
import MyInput, { MyInputHandles } from './MyInput';
const Autofocus = () => {
const myInputRef = useRef<MyInputHandles>(null);
useEffect(() => {
if (myInputRef.current) {
myInputRef.current.focus();
}
});
return <MyInput ref={myInputRef} />
}
@jt3k
Copy link

jt3k commented May 29, 2021

it looks like your code is in error. otherwise the typescript would not show an error
https://tinyurl.com/46w49fsj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment