const fallbackCopyToClipboard = (textToCopy: string) => {
// Create textarea in Document, focus and select
let textArea = document.createElement('textarea');
textArea.value = textToCopy;
textArea.style.position = 'fixed';
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
let successful = document.execCommand('copy');
if (!successful) {
throw new Error('execCommand failed to copy to clipboard');
}
} catch (err) {
throw new Error(`execCommand failed: ${err}`);
} finally {
// Remove the created Textarea
document.body.removeChild(textArea);
}
};