useUnmount
Runs a callback when the component unmounts.
Usage
import { useUnmount } from "@siberiacancode/reactuse";
useUnmount(() => console.log("unmounted"));Example
import { useUnmount } from "@siberiacancode/reactuse";
export const Cleanup = () => {
useUnmount(() => {
console.log("cleanup");
});
return <div>Unmount me</div>;
};Type Declarations
export declare const useUnmount: (callback: () => void) => void;