UNPKG

@figliolia/react-hooks

Version:

A small collection of simple React Hooks you're probably rewriting on a regular basis

15 lines (12 loc) 322 B
import { useEffect } from "react"; import { Timeout } from "Generics/Timeout"; import { useController } from "./useController"; export const useTimeout = () => { const timeout = useController(new Timeout()); useEffect(() => { return () => { timeout.abortAll(); }; }, [timeout]); return timeout; };