@elaineleung
Posted
Hi Ághata, great work on the JS here, and the component works well 🙂
I think what you did here in the JS is fine; the code is clear, the variables and functions are clearly named, and things just look clean in general. The only I thing I would do differently here is that, instead of having the onclick
in the HTML, I would use an addEventListener
as I generally prefer this when working with vanilla JS. I think this is better for the separation of concerns and the ability to see everything easily where all the interaction is in the JS script instead of having some in the HTML as attributes. There's really nothing wrong with using onclick
in the HTML though, just a matter of general practice plus personal preference. For further reading, you can check out this article in medium: https://medium.com/@annapeterson89/addeventlistener-vs-onclick-which-one-should-you-draft-into-your-fantasy-football-team-16ea9ae71ee0
About the CSS, I think you can give the component a bit more padding, as things look a bit squished and can use some additional spacing. Other than that, everything's looking good!
Marked as helpful
@a-almeida10
Posted
@elaineleung Hello, Elaine :D Thank you for looking into my code and giving me your feedback, I really appreciate it. I'm going to read the article you suggested and learn more about addeventListener.