Proposition for fixing the error with multiple re-renders #31
Closed
alefDev-prog
started this conversation in
Ideas
Replies: 2 comments 1 reply
-
|
Let's try to address this with your open PR. I will draw inspo from your suggestion and work on styling those Toasts as well! Huge thanks, @alefDev-prog |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@alefDev-prog Updating Handlers in Clipboard Image component #51 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was very curious on how one may fix the error with the
ClipboardImagecomponent re-rendering several times on one click. I understand that you may have your own idea on how to deal with this but I just wanted to share how I have dealt with this problem.What I did:
userRefhook to reference the image elementhandleClickfunction and within that function I call thepasteImageuseEffecthook and transitioned the "load" eventListener to it.These changes resulted in that the
pasteImagefunction only get called once per click.I will provide a link to the code if you want to have a look at it: code
Beta Was this translation helpful? Give feedback.
All reactions