Created
February 13, 2019 05:48
-
-
Save jrwebdev/0b7ba1f0bd0da2dcdecdd1112c0f2787 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MyInput, { MyInputHandles } from './MyInput'; | |
const Autofocus = () => { | |
const myInputRef = useRef<MyInputHandles>(null); | |
useEffect(() => { | |
if (myInputRef.current) { | |
myInputRef.current.focus(); | |
} | |
}); | |
return <MyInput ref={myInputRef} /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it looks like your code is in error. otherwise the typescript would not show an error
https://tinyurl.com/46w49fsj