react save something to clipboard code example
Example 1: react copy to clipboard
onClick={() => {navigator.clipboard.writeText(this.state.textToCopy)}}
Example 2: react copy to clipboard button
<buttononClick={() => navigator.clipboard.writeText("Copy this text to clipboard")}>
Copy
</button>