Package Exports
- use-clipboard-hook
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (use-clipboard-hook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
use-clipboard
Copy to clipboard React hook.
Install
npm install --save use-clipboard
Usage
import * as React from "react";
import { useClipboard } from "use-clipboard";
const Example = () => {
const [inputRef, onClick] = useClipboard({
onCopy: (text) => console.log(`Copied: ${text}`),
});
return (
<div>
<input ref={inputRef} defaultValue="Change this..." />
<button onClick={onClick}>copy</button>
</div>
);
};
Live Demo
License
MIT © fayeed
This hook is created using create-react-hook.