Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 550 Bytes

README.md

File metadata and controls

26 lines (20 loc) · 550 Bytes

⌨ useClipboard

A React hook that simplifies copying text to the clipboard. It offers an easy-to-use API for copying text and verifying if the operation was successful.

Usage

import React from 'react';
import { useClipboard } from '@codiume/hooks';

export default function App() {
  const { copy, copied } = useClipboard();

  const handleCopy = () => {
    copy('Hello, world!');
  };

  return (
    <div>
      <button onClick={handleCopy}>
        {copied ? 'Copied!' : 'Copy to Clipboard'}
      </button>
    </div>
  );
}