- Easy way to use Clipboard API into your React project;
To start using the use-clipboard-api
in your project, first install in your project:
yarn add use-clipboard-api
or npm install use-clipboard-api
Copy to clipboard:
import useClipboardApi from 'use-clipboard-api';
function App() {
const [value, copy] = useClipboardApi();
return (
<div>
<button onClick={() => copy('Text to be copied.')}>Copy me!</button>
<p>Copied value: {value}</p>
</div>
);
}
export default App;
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Report bugs or do suggestions using the issues.