web-copy-to-clipboard
Version:
Simple module that copies a text to clipbard.
32 lines (24 loc) • 679 B
Markdown
# web-copy-to-clipboard 📋
This is a simple module that helps you to easily implement a functionality to copy text to clipboard.
## Installation
Run:
`npm install web-copy-to-clipboard`
or
`yarn add web-copy-to-clipboard`
## Usage
All you need to do is to import the module, and then call it's function anywhere you want to trigger it.
React.js example:
```js
import React from 'react';
import copyToClipboard from 'web-copy-to-clipboard';
export default function App() {
return (
<button
// calling the function when clicking a button
onClick={() => copyToClipboard("I'll be copied!")}
>
'Copy text'
</button>
)
}
```