Created
October 25, 2020 19:34
-
-
Save lxsmnsyc/600db114d759ca793a0c1915d7c3fbdf 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 { useEffect } from 'react'; | |
export type Dispose = () => void; | |
export default function useDispose(dispose: Dispose): void { | |
const timeout = setTimeout(dispose, 64); | |
useEffect(() => { | |
clearTimeout(timeout); | |
}, [timeout]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment