Design comparison
Solution retrospective
Hi Everyone, This is my current practice using react, typescript and sass. I have a problem with the copy button, when I click one button from the list all other controls on the list change the style, please let me know if someone has a fix for it.
Feedback is appreciated and welcomed.
Community feedback
- @allmtzPosted almost 2 years ago
Really nice job and congratulations on completing the challenge !
As to your question: It looks like the problem is that all the Button components render based on the same
isCopied
variable:title={ isCopied ? "Copied!" : "Copy" }
As a result, when the value of
isCopied
changes, every Button is affected . Instead, You need a way to uniquely identify if an individual Button is copied or not. For example:title={ uniqueBtnID === copiedID ? "Copied!" : "Copy" }
You could set the state of
copiedID
whenever a button is clicked. I submitted a pull request with a possible fix, let me know if it helps !Marked as helpful1@BeshoySPosted almost 2 years ago@ramenDiet Thank you for the solution, I understand the problem, and I merged the request.
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord