useUnmount
A hook that executes the function right before the component is unmounted.
Overview
A hook that executes the function right before the component is unmounted.
Installation
Open inpnpm dlx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.jsonnpx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.jsonyarn shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.jsonbun shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.jsonA hook that executes the function right before the component is unmounted.
Examples
Default Usage
API
useUnmount(fn: () => void);Params
| Property | Description | Type | Default |
| -- | ---- |
| fn | The function to be executed | () => void | - |