react-copy-text
Copy text to the clipboard like it's 1999
Beautifully simples React component to copy the text
you give to it, with optional onCopied
callback so you know when it's done.
Install
npm install react-copy-text
Usage
state = textToCopy: '' this console { return <div> <button onClick=thisonButtonClick>Copy some text</button> <CopyText text=thisstatetextToCopy onCopied=thisonCopied /> </div> }
API
<CopyText />
text
Type: PropTypes.string
The text to copy to the clipboard.
onCopied
Type: PropTypes.func
Callback function called after the text has been copied to the clipboard. Passed the text that was copied.
A (╯°□°)╯︵TABLEFLIP side project.