@figliolia/react-hooks
Version:
A small collection of simple React Hooks you're probably rewriting on a regular basis
13 lines (12 loc) • 351 B
JavaScript
import { useEffect } from "react";
import { Timeout } from "../Generics/Timeout.js";
import { useController } from "./useController.js";
export const useTimeout = () => {
const timeout = useController(new Timeout());
useEffect(() => {
return () => {
timeout.abortAll();
};
}, [timeout]);
return timeout;
};