import { useEffect } from 'react'
import { useLatest } from '@/registry/hooks/use-latest'
export function useUnmount(fn: () => void) {
const fnRef = useLatest(fn)
useEffect(
() => () => {
fnRef.current()
},
[],
)
}
npx shadcn@latest add @hooks/use-unmountimport { UseUnmount } from "@/hooks/use-unmount"const value = UseUnmount()