react-use-copy-to-clipboard
v1.0.1
Published
this hook is needed to copy text to the clipboard when clicking on any element
Downloads
64
Readme
react-use-copy-to-clipboard
Install
npm install --save react-use-copy-to-clipboard
Usage
import React from "react";
import {useCopyToClipboard} from "react-use-copy-to-clipboard";
export const CopyButton = ({text}) => {
const clickRef = useCopyToClipboard(text,
() => console.log("Copyed!"),
() => console.log("Unable to copy!"))
return (
<button ref={clickRef}>Copy!</button>
)
}
License
MIT © code0-st
This hook is created using create-react-hook.