add task solution#3764
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly handles all functional requirements - the Person component renders properly with conditional age and marital status display. However, two explicit checklist items are violated that must be addressed: [CHECKLIST ITEM #1] In App.jsx, the person object properties (name, age, isMarried, sex, partnerName) are accessed directly instead of being destructured. Change ({ person }) to destructure the inner properties, then use the variables directly. [CHECKLIST ITEM #3] In Person.jsx, the conditional rendering logic combines multiple conditions (isMarried check, sex check, and partner text) directly in JSX. Extract this to a partnerText variable before the return statement that determines the appropriate text based on marital status and sex, then render that variable. While the code works functionally, these checklist requirements exist to enforce consistent coding patterns, and addressing them will improve code maintainability.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| <p className="Person__partner"> | ||
| {!person.isMarried && 'I am not married'} | ||
|
|
||
| {person.isMarried && | ||
| person.sex === 'm' && | ||
| `${person.partnerName} is my wife`} | ||
|
|
||
| {person.isMarried && | ||
| person.sex !== 'm' && | ||
| `${person.partnerName} is my 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 conditional expression combines multiple conditions (isMarried check, sex check, and the partner text) within the same rendering block. Consider creating a partnerText variable that determines the appropriate text based on marital status and sex, then render that variable.
| @@ -1,5 +1,6 @@ | |||
| import React from 'react'; | |||
There was a problem hiding this comment.
Checklist Item #1 Violation: Properties of person object (name, age, isMarried, sex, partnerName) are accessed directly without destructuring. Destructure them at the component level:
const { name, age, isMarried, sex, partnerName } = person;
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly meets all requirements and successfully addresses the previous checklist violations. In Person.jsx, the props are properly destructured in the function parameters, and the conditional rendering logic is correctly extracted into a partnerText variable with properly formatted ternary operator where each operand is on its own line. In App.jsx, the Person component is used 3 times with the full person object passed as a prop (<Person person={misha} /> syntax). All checklist items pass, including props destructuring and ternary formatting, and no functional or code style issues remain. Great work!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.