Design comparison
Solution retrospective
This is my first time using React for my project which is a bit difficult for me. I have some problems with inputs' values and tried to fix them. Any suggestions or comments are appreciated. Thank you!
Community feedback
- @elaineleungPosted over 2 years ago
Hi Nhan Pham, well done using React for the first time in a project here, and I think this is a really good try. I think the only key thing I would fix is that, right now if the last value that I choose is the "people" option, after I input the number the calculation doesn't happen right away, and it only happens if I click on another tip button. This doesn't happen if the tip is the last value I submit, it's only with the inputs. I suggest adding a handler that also performs calculation when an input is detected.
Some other things I'd suggest:
-
You can try using
type="number"
instead oftype="text"
, as that would help with some validations already -
For the form, I see that there's some code being repeated in the rendering when you're using conditionals. I can see this being rewritten when you don't have to repeat the code; instead, you can just perform the conditional checks in the variables for the event handlers and classes.
-
You're getting some accessibility issues in your report because you don't have a
main
tag, so try adding one at the top level to take care of those issues.
Great job, and keep going!
Marked as helpful1 -
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