Shadcn Hooks

useUnmount

A hook to run a function when the component unmounts

Installation

npx shadcn@latest add @shadcnhooks/use-unmount

API

/**
 * A hook to run a function when the component unmounts
 * @param fn - The function to run when the component unmounts
 * @returns The function to run when the component unmounts
 */
export function useUnmount(fn: () => void): void

Credits

Last updated on

On this page