Last active
March 5, 2019 00:56
-
-
Save treyhuffine/40628c69cc18bdfeedd6d65373249d15 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function DelayedEffect(props: { timerMs: number }) { | |
| const { timerMs } = props; | |
| // ** BAD! ** setTimeout implicitly returns a number because the arrow function body isn't wrapped in curly braces | |
| useEffect(() => setTimeout(() => {/* do stuff */}, timerMs), [timerMs]) | |
| // ** | |
| return null | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment