Works by selecting a string given as a prop and then copies it. Almost no dependencies.
npm install react-copy --save
or
yarn add react-copy
import Copy from 'react-copy';
...
<Copy textToBeCopied={this.state.text}>
<button>
Copy the text please please
</button>
</Copy>
Type: PropTypes.string.isRequired
The text that should be copied on button click
Type: PropTypes.element.isRequired
Exactly one child is required as a click handler for copying, e.g. a button
Type: PropTypes.func
A callback function called when copy function is called
Type: PropTypes.object
Optional style object
For a real world use-case checkout a demo (https://github.com/hamsterbacke23/movierater)
Also check out