shadcn-ahooks

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.

Documentation and Examples

Installation

Open in
pnpm dlx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.json
npx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.json
yarn shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.json
bun shadcn@latest add https://shadcn-ahooks.vercel.app/r/useUnmount.json

A 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 | - |

On this page