UNPKG

@ducor/react

Version:

admin template ui interface

15 lines (14 loc) 415 B
import { useEffect } from "react"; /** * `useUnmountEffect` runs the provided callback function when the component unmounts. * * @param fn - The function to execute on unmount. */ var useUnmountEffect = function (fn) { useEffect(function () { return function () { fn(); }; }, []); // Empty dependency array ensures it only runs on unmount }; export default useUnmountEffect;