Skip to main content

useUnmount

A custom hook that calls a callback function when the component is unmounted.


Code

🔗 View source code


Interface

typescript
function useUnmount(callback: () => void): void

Parameters

NameTypeDescription
callback() => voidCallback function to invoke on unmount

Usage

typescript
import { useUnmount } from '@modern-kit/react';

const Example = () => {
useUnmount(() => console.log("unmount"));

return <>{/* ... */}</>;
};