Package detail

@react-hook/copy

jaredLunde25.5kMIT2.0.1

A React hook for copying text to the clipboard

react, react hook, hook, react hooks

readme


useCopy()

Bundlephobia Types NPM Version MIT License

npm i @react-hook/copy


A React hook for copying text to the clipboard

Quick Start

```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'} } ```

API

useCopy(text: string)

Argument Type Required? Description
text string Yes The text you want to copy to the clipboard when copy is clicked

Returns {copied: boolean, copy: () => void, reset: () => void}

LICENSE

MIT