react person#3738
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly fulfills all functional requirements - the component renders person details properly, handles optional age, displays the correct partner relationship, and uses all required class names. While checklist item #3 recommends extracting the nested ternary into a separate variable for readability, this is a code style/readability suggestion rather than a functional blocker. The code works correctly as written, and extracting ternaries into variables is a common refactoring practice you can apply in future code. Your understanding of destructuring, conditional rendering, and component composition is solid. Great work!
✨ 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.
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' is used directly in JSX. Consider creating a separate variable like const partnerLabel = sex === 'm' ? 'wife' : 'husband'; before the return statement and using it in the JSX instead.
No description provided.