useUnmount
A custom hook that calls a callback function when the component is unmounted.
Code
Interface
typescript
function useUnmount(callback: () => void): void
Parameters
| Name | Type | Description |
|---|---|---|
callback | () => void | Callback function to invoke on unmount |
Usage
typescript
import { useUnmount } from '@modern-kit/react';
const Example = () => {
useUnmount(() => console.log("unmount"));
return <>{/* ... */}</>;
};