UNPKG

qol-hooks

Version:

A collection of React hooks to improve the quality of life of developers.

19 lines (18 loc) 540 B
/** * Custom hook for copying text to the clipboard. * @returns An array containing a boolean indicating whether the text has been copied and a function to copy text to the clipboard. * * @example```tsx * const Component = () => { * const [copied, copy] = useClipboard(); * * return ( * <div> * <button onClick={() => copy("Hello, World!")}>Copy</button> * {copied && <p>Copied to clipboard!</p>} * </div> * )}; * ``` */ declare function useClipboard(): [boolean, (text: string) => void]; export default useClipboard;