useCopy.ts16 lines · main
| 1 | 'use client' |
| 2 | |
| 3 | import { useState } from 'react' |
| 4 | |
| 5 | export function useCopy() { |
| 6 | const [copied, setCopied] = useState(false) |
| 7 | |
| 8 | function handleCopy() { |
| 9 | setCopied(true) |
| 10 | setTimeout(() => { |
| 11 | setCopied(false) |
| 12 | }, 1000) |
| 13 | } |
| 14 | |
| 15 | return { copied, handleCopy } |
| 16 | } |