onClick={() => {navigator.clipboard.writeText(this.state.textToCopy)}} <button onClick={() => navigator.clipboard.writeText('Copy this text to clipboard')} > Copy </button>