Skip to content

Instantly share code, notes, and snippets.

@ShuvoHabib
Created June 14, 2020 13:13
Show Gist options
  • Save ShuvoHabib/8e4b8d93d540ce3fca7923dc3fb927a4 to your computer and use it in GitHub Desktop.
Save ShuvoHabib/8e4b8d93d540ce3fca7923dc3fb927a4 to your computer and use it in GitHub Desktop.
import {CopyToClipboard} from 'react-copy-to-clipboard';
state = {
showCopyText: null
};
copyNumber = () => {
this.setState({
showCopyText: "bKash number copied to clipboard"
});
setTimeout(() => {
this.setState({
showCopyText: null
});
}, 2000)
};
<CopyToClipboard text={number}>
<button onClick={this.copyNumber} className="copy-btn">Copy</button>
</CopyToClipboard>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment