copy text in clipboear react code example
Example 1: react copy to clipboard
onClick={() => {navigator.clipboard.writeText(this.state.textToCopy)}}
Example 2: how to copy to clipboard in react js
<button
onClick={() => navigator.clipboard.writeText('Copy this text to clipboard')}
>
Copy
</button>