Interactive rating component solution - Vanilla JS
Design comparison
Solution retrospective
What I Learned
In this project, I reinforced my recent studies by keeping state in an app and using this to influence styles. I also used some arrow functions and template literals in order to keep the code as clean as possible. Here is one of my favorite implementations of an arrow function in my code!
document.querySelector(".submit").addEventListener("click", () => {
if (clicks > 0) {
ratingsCard.classList.add("hidden");
thanksCard.classList.remove("hidden");
}
});
Where to Improve
I'm not sure that my solution to the problem of adding and removing the current active rating style is the cleanest and would be very interested to hear how other people have approached this problem. In this project, I was primarily aiming to practice my JS skills but it has definitely brought to light some weaknesses in my CSS skills!
As always, any feedback is much appreciated.
Cheers, Dan
Community feedback
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