add task solution#3760
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly fulfills all core functional requirements: the Person component renders details with proper class names, handles optional age, displays the correct partner labels ("wife"/"husband"), and shows "I am not married" for unmarried persons. The component is used three times in App with the entire person object passed as props.
There are two code style improvements that should be addressed to align with the checklist guidelines [CHECKLIST #1 and #3]:
-
Props destructuring — In
Person.jsx, destructure thepersonobject at the component level:const Person = ({ person }) => { const { name, age, sex, isMarried, partnerName } = person; // ... };
-
Extract nested ternary to a variable — The conditional
person.sex === 'm' ? 'wife' : 'husband'should be computed as a separate variable before the return statement rather than nested inline.
These are style-related improvements rather than functional blockers — your code works correctly and passes all tests. Address these checklist items and you'll have a fully compliant submission.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| // export const Person = ({ person }) => (); | ||
| import './Person.scss'; | ||
|
|
||
| export const Person = ({ person }) => ( |
There was a problem hiding this comment.
This violates checklist item #1: Use destructuring for getting access to values of props object. The person object's properties (name, age, sex, isMarried, partnerName) should be destructured instead of accessing them via person.propertyName.
| <p className="Person__partner"> | ||
| {person.isMarried | ||
| ? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` |
There was a problem hiding this comment.
This violates checklist item #3: Avoid putting several cases to conditional rendering. The nested ternary person.sex === 'm' ? 'wife' : 'husband' should be extracted to a separate variable before the return statement.
DEMO LINK