{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-on-unmount",
  "title": "UseOnUnmount",
  "description": "Executes a function only once when the component is unmounted.",
  "files": [
    {
      "path": "registry/hooks/use-on-unmount.tsx",
      "content": "'use client';\n\nimport { useEffect, useRef } from 'react';\n\nexport function useOnUnmount(callback: () => void): void {\n  const fnRef = useRef(callback);\n\n  fnRef.current = callback;\n\n  useEffect(() => {\n    return () => {\n      fnRef.current();\n    };\n  }, []);\n}\n",
      "type": "registry:hook",
      "target": "hooks/guarahooks/use-on-unmount.tsx"
    }
  ],
  "categories": [
    "lifecycle"
  ],
  "type": "registry:hook"
}