# `useCopyToClipboard`
Copy text to a user's clipboard.
## Usage
```jsx
const Demo = () => {
const [text, setText] = React.useState('');
const [state, copyToClipboard] = useCopyToClipboard();
return (
setText(e.target.value)} />
{state.error
?
Unable to copy value: {state.error.message}
: state.value &&
Copied {state.value}
}
)
}
```
## Reference
```js
const [{value, error, noUserInteraction}, copyToClipboard] = useCopyToClipboard();
```
- `value` — value that was copied to clipboard, undefined when nothing was copied.
- `error` — caught error when trying to copy to clipboard.
- `noUserInteraction` — boolean indicating if user interaction was required to copy the value to clipboard to expose full API from underlying [`copy-to-clipboard`](https://github.com/sudodoki/copy-to-clipboard) library.