Tip Calculator Component using React & SCSS

Solution retrospective
Hi all,
Excited to submit my 10th solution - I've definitely made progress since my first submission! Any pointers on where I can continue to improve would be amazing!
One area of my solution I am unsure about is the code that validates the inputs before displaying Tip/Person and Total/Person output. Is there anyway to make this cleaner?
const getTip = (props.billAmount && props.people > 0) ? (props.billAmount * (props.percentage/100)/props.people).toFixed(2) : "0.00"
const getTotal = (props.billAmount && props.people > 0) ? (props.billAmount * (1 + props.percentage/100)/props.people).toFixed(2) : "0.00"
Thanks again for the advice!
- Tyler
Please log in to post a comment
Log in with GitHubCommunity feedback
No feedback yet. Be the first to give feedback on Tyler's solution.
Join 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