Design comparison
Solution retrospective
- I used React to build the website.
- My website is 100% accessible -Ability to keep the background colour of the rating button when I make a selection, which I couldn't accomplish the first time I created the project using HTML, CSS, and Javascript
Utilising usestate
What specific areas of your project would you like help with?I would greatly appreciate a blog, video, or other resource that thoroughly explains useState. Although I've learned about useState, I'm still having some difficulties understanding it fully."
Community feedback
- @Ozzy-codesPosted 3 months ago
Hi @G-Gakii!
Congrats on completing this project.
I forked your repo and made a pull request for how you may want to retain a background color on your circles! If you would like to see an alternative approach via radio buttons take a look at this repo from @llr3v0ll
Marked as helpful0 - @IzykGitPosted 3 months ago
Good work!
To keep the background color changed after the user has clicked on their number has two approaches.
First you could create a new class with all the same properties but change the background color and toggle these classes when a user clicks on a number. Or second you could directly change the background color of the clicked number in your javascript document
document.getElementById("your-element).style.backgroundColor = "your color here"
.These are two easy approaches that should help you fix your issue! Keep up the good work.
Marked as helpful0
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