useUnmount
Custom hook that runs a cleanup function when the component is unmounted.
Installation
npx sse-tool add use-unmount
npm install sse-hooks
Usage
import { useUnmount } from "./{hooks file}";
useUnmount(() => {
// Cleanup logic here
});
import { useUnmount } from "sse-hooks";
useUnmount(() => {
// Cleanup logic here
});
API
Parameters
| Name | Type | Description |
|---|---|---|
| func | Function | The cleanup function to be executed on unmount. |