JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="src">Type something here</textarea>
<button id="copy">Then Click this</button>
<textarea id="dest"></textarea>

CSS

body * {
    display: block;
    margin: 0px;
}

JavaScript

var cpButton = document.getElementById('copy'),
    srcText = document.getElementById('src'),
    destText = document.getElementById('dest');

cpButton.addEventListener('click', function() {
    srcText.select();
    document.execCommand('copy');
});