Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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