# use-copy

> A React Hook that provides an easy interface to copy textual data.

Latest version **0.0.2** (published 2019-05-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-copy
pnpm add use-copy
yarn add use-copy
bun add use-copy
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-05-13 |
| First published | 2019-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Stefan Mansson |
| Maintainers | animify |
| Keywords | copy, use-copy, react hook, react hooks, useCopy |

## Links

- npm: https://www.npmjs.com/package/use-copy
- Repository: https://github.com/animify/useCopy
- npm.io page: https://npm.io/package/use-copy

## Dependencies (1)

- [copy-to-clipboard](https://npm.io/package/copy-to-clipboard.md) ^3.2.0

## Recent versions

- 0.0.2 (latest) — 2019-05-13
- 0.0.1 — 2019-05-13

## README

# useCopy 📋

 A React Hook that provides an easy interface to copy textual data.
 
 ```js
import React from 'react';
import useCopy from 'use-copy';

function Count() {
    const [copied, copy, setCopied] = useCopy("Text to copy");

    const copyText = () => {
      copy();

      setTimeout(() => {
        setCopied(false);
      }, 3000);
    };

    return (
        <div>
            { copied ? "Copied to clipboard" : <a onClick={copyText}>Copy text</a> }
        </div>
    );
}
```

[Full example on Code Sandbox](https://codesandbox.io/s/101qo4m9n3)

## Install

```bash
# Yarn
yarn add use-copy

# NPM
npm install use-copy
```

## Features

- Feather light
- Pass dynamic text
- Easy interface
- Full Typescript support
- Uses the battle-tested [copy-to-clipboard](https://github.com/sudodoki/copy-to-clipboard)

## Prerequisites

⚠️ React hooks require `react` at version 16.7.0-alpha.0 or higher.

## Issues & suggestions

If you find any runtime issues or have any suggestions on how to improve the package please do open an [issue](https://github.com/animify/useCopy/issues)!

## License

[MIT License](LICENSE)

---
_Source: https://npm.io/package/use-copy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
