Design comparison
Solution retrospective
How did you make this code DRY? The components for Reply and Comment were nearly identical, but it was so confusing to write the logic for the actions without two separate components.
Community feedback
- @Dr-Wrong-MoPosted over 2 years ago
To your question about keeping your code DRY, I created a JS file for all my HTML templates. Where I saw significant commonalities, I would break those sections into partial templates. Here's the file in my GitHub repo if you're curious. Scroll down to line 79 to see what I mean.
https://github.com/Dr-Wrong-Mo/fem-interactive-comments-section/blob/master/src/scripts/templates_html.js
I used that template for both comments and replies.
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