usehooks icon indicating copy to clipboard operation
usehooks copied to clipboard

Add missing return statement to copyToClipboard util

Open MorisR opened this issue 6 months ago • 2 comments

While using the useCopyToClipboard hook I noticed that the 2nd argument returned by the hook (the copyToClipboard callback) does not match the typescript signature. https://github.com/uidotdev/usehooks/blob/945436df0037bc21133379a5e13f1bd73f1ffc36/index.d.ts#L126-L129

By adding a return before the handleCopy function call, the callback now returns the promise, which now allows you to chain a .then() and .catch() to it, while previously it used to throw

image

MorisR avatar Jul 28 '25 15:07 MorisR

Hey @tylermcginnis can you have a quick 👀 please?


Update: Sorry for the causal message 😅 (it didn't dawn on me that it might be a bit rude and a bit too direct), would appreciate your help here! 🙇

MorisR avatar Jul 28 '25 15:07 MorisR

duplicated of #313 :eyes:

alejsdev avatar Oct 23 '25 12:10 alejsdev