Fix Person component - #3865
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution because all required functionality works: props are correctly destructured, all three persons render as expected, age and marital status are handled correctly, and class names match the requirements. There are, however, two style issues to address for readability and checklist compliance.
- [CHECKLIST ITEM #2] In src/components/Person/Person.jsx, the ternary operator is on a single line; each operand should be on its own line (e.g., split condition, truthy, and falsy branches across separate lines) for clarity.
- [CHECKLIST ITEM #3] Also in Person.jsx, avoid nested ternaries for conditional rendering; extract the inner
sex === 'm' ? 'wife' : 'husband'into a variable likeconst partnerType = ...and then use{partnerName} is my {partnerType}.
These are non-blocking style fixes; the core behavior is solid. Nice work—just make those readability adjustments to align with the checklist.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| {isMarried ? ( | ||
| <p className="Person__partner"> | ||
| {partnerName} is my {sex === 'm' ? 'wife' : 'husband'} |
There was a problem hiding this comment.
Checklist item #2 violation: Ternary operator operands should each be on a separate line for readability. Currently all operands are on the same line as the condition.
| {isMarried ? ( | ||
| <p className="Person__partner"> | ||
| {partnerName} is my {sex === 'm' ? 'wife' : 'husband'} |
There was a problem hiding this comment.
Checklist item #3 violation: Avoid putting several cases to conditional rendering. The inner ternary sex === 'm' ? 'wife' : 'husband' should be extracted to a separate variable (e.g., const partnerType = sex === 'm' ? 'wife' : 'husband';) and then used as {partnerName} is my {partnerType}.
DEMO LINK