use-copy-clipboard-hook
v1.1.5
Published
The easiest way to use copy to clipboard in React as a custom hook 🪝
Downloads
6
Readme
Copy Clipboard Custom Hook 🪝
The easiest way to use copy to clipboard in React as a custom hook 🪝
Installation
npm i use-copy-clipboard-hook
Usage
import { useCopyToClipboard } from "use-copy-clipboard-hook";
function App() {
const [copied, copyToClipboard] = useCopyToClipboard();
return (
<div className="App">
<button onClick={() =>
copyToClipboard('Copy Text', 3000)}>Copy</button>
{copied ? "Text copied 🥳🥳" : "Copy 🤖"}
</div>
);
}
export default App;