Skip to content

Instantly share code, notes, and snippets.

@arinaldi
Created January 27, 2022 17:25
Show Gist options
  • Save arinaldi/b6ba17a09be61a0fafc25eb02bfbe773 to your computer and use it in GitHub Desktop.
Save arinaldi/b6ba17a09be61a0fafc25eb02bfbe773 to your computer and use it in GitHub Desktop.
Copy text to clipboard
async function copy() {
await navigator.clipboard.writeText(code);
setCopyText('✅ Copied!');
setTimeout(() => {
setCopyText('Copy');
}, 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment