Remember that one-liners are not always better/faster/easier.
Readability goes over being clever.
Especially when a one-liner only passes its parameters to another method like this one
const copyToClipboard = (content) => navigator.clipboard.writeText(content);
What's wrong with just:
navigator.clipboard.writeText(content);
If anything, the copyToClipboard should check if the clipboard API is available to use.
copyToClipboard
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Remember that one-liners are not always better/faster/easier.
Readability goes over being clever.
Especially when a one-liner only passes its parameters to another method like this one
What's wrong with just:
If anything, the
copyToClipboardshould check if the clipboard API is available to use.A guide to writing clean and readable code
Mr. Linxed ・ Feb 23