Time Tracking Dashboard using React

Solution retrospective
Hi all,
Here is my solution for the Time Tracker Dashboard challenge. I enjoyed this project and used it as an opportunity to refine and clean up my code. Any thoughts or guidance on how I can improve in this area is appreciated. Specifically, I had a question about If Statements - is there anyways to shorten this code?
const convertTimeframe = () => {
if(props.timeframe === "Daily"){
return "Yesterday"
} else if (props.timeframe === "Weekly"){
return "Last week"
} else if (props.timeframe === "Monthly"){
return "Last month"
}
}
Thanks so much! -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