@lokibai/react-use-copy-clipboard
v1.0.5
Published
copy to clipboard
Downloads
262
Readme
@lokibai/react-use-copy-clipboard
copy to clipboard
Install
npm install --save @lokibai/react-use-copy-clipboard
Usage
import React from 'react';
import { useCopyClipboard } from '@lokibai/react-use-copy-clipboard';
const App = () => {
const [isCopied, setCopied] = useCopyClipboard('initial text');
const handleClick = () => {
// setCopied('text');
setCopied();
};
return (
<button onClick={handleClick}>Was it copied? {isCopied ? 'Yes! 👍' : 'Nope! 👎'}</button>
);
};
License
This hook is created using create-react-library.