{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-previous",
  "title": "UsePrevious",
  "description": "Tracks the previous value of a state.",
  "files": [
    {
      "path": "registry/hooks/use-previous.tsx",
      "content": "'use client';\n\nimport { useEffect, useRef } from 'react';\n\nexport function usePrevious<T>(value: T): T | undefined {\n  const ref = useRef<T>(value);\n\n  useEffect(() => {\n    ref.current = value;\n  }, [value]);\n\n  return ref.current;\n}\n",
      "type": "registry:hook",
      "target": "hooks/guarahooks/use-previous.tsx"
    }
  ],
  "categories": [
    "ui-and-dom"
  ],
  "type": "registry:hook"
}