A React hook for copying text to the clipboard
npm install @react-hook/copynpm i @react-hook/copy
A React hook for copying text to the clipboard
``jsx harmony
import useCopy from '@react-hook/copy'
const Component = (props) => {
const {copied, copy, reset} = useCopy(
'This text will be copied to the clipboard'
)
return {copied === false ? 'Copy' : 'Copied'}
}
`
| Argument | Type | Required? | Description |
| -------- | -------- | --------- | ----------------------------------------------------------------- |
| text | string | Yes | The text you want to copy to the clipboard when copy` is clicked |
MIT