Stop reinventing the wheel
You can stop copying that clipboard logic off of stack overflow and no I'm not telling you to use an LLM.
All of the common utilities you might need in javascript have been packaged up into one clean and well tested set of intuitive composables for you to use.
There's one for each of the major frameworks.
Check out the docs at reactuse.com, vueuse.org, or even sv-use.org for Svelte. And heck, tell your LLM to stop reinventing the wheel too while your at it.
The list of utilities in these packages spans from local storage, drop zones, window size, css variables and so, so much more.
I guarantee you'll find something useful in there.