I\'m using ReactJS and when a user clicks a link I want to copy some text to the clipboard.
I am using Chrome 52 and I do not need to support any other browsers.
import React, { Component } from 'react'; export default class CopyTextOnClick extends Component { copyText = () => { this.refs.input.select(); document.execCommand('copy'); return false; } render () { const { text } = this.state; return ( { text } ) } }