useUnmount
Custom hook that runs a cleanup function when the component is unmounted.
Installation
npx sse-hooks add use-unmount
yarn dlx sse-hooks add use-unmount
pnpm dlx sse-hooks add use-unmount
deno run -A npm:sse-hooks add use-unmount
bunx sse-hooks add use-unmount
Usage
example.ts
import { useUnmount } from "./{hooks file}";
useUnmount(() => {
// Cleanup logic here
});
API
Parameters
| Prop | Default | Type |
|---|---|---|
func | - |
The cleanup function to be executed on unmount. |
Returns
| Return Value | Default | Type |
|---|---|---|
return | - |
Hook return value |
Types Aliases
No specific type aliases defined for this component.