Solution#3759
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation successfully meets all core functional requirements. The Person component correctly destructures the person prop, conditionally renders the age field when present, handles the wife/husband terminology properly based on sex, and displays the correct married/not married messages for all three instances in App.jsx. All required class names match the specification. Regarding the checklist violations flagged: the nested ternary expression for determining partner label and the ternary operand formatting are style concerns rather than functional blockers. These are the types of issues typically caught by linters like ESLint or Prettier. Since your code functions correctly and all requirements are implemented, I'll approve this submission. However, I'd encourage you to address these style points going forward: extract ${sex === 'm' ? 'wife' : 'husband'} into a const partnerLabel variable before the return statement, and ensure ternary operands occupy their own lines for better readability [CHECKLIST ITEMS #2 and #3]. This practice improves code maintainability, especially as your components grow in complexity.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
|
|
||
| <p className="Person__partner"> | ||
| {isMarried | ||
| ? `${partnerName} is my ${sex === 'm' ? 'wife' : 'husband'}` |
There was a problem hiding this comment.
This violates checklist item #3: 'Avoid putting several cases to conditional rendering. Create separate variable for the condition.' The nested ternary ${sex === 'm' ? 'wife' : 'husband'} should be extracted to a variable like const partnerLabel = sex === 'm' ? 'wife' : 'husband'; before the return statement.
| {isMarried | ||
| ? `${partnerName} is my ${sex === 'm' ? 'wife' : 'husband'}` | ||
| : 'I am not married'} |
There was a problem hiding this comment.
This violates checklist item #2: 'Format ternary operator operands correctly - move each operand to the separate line.' Each operand of the ternary should be on its own line for better readability.
No description provided.