Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great work on implementing the core functionality! The Person component correctly renders all the required information, and it's used properly within the App component.
However, this requires a couple of changes to align the code with the project's checklist, which are considered blocking requirements for this task.
- Incomplete Prop Destructuring [CHECKLIST ITEM #1]: In
src/components/Person/Person.jsx, while you've destructuredpersonfromprops, you should also destructure the properties within thepersonobject (likename,age,sex). This makes the code cleaner by avoiding repetition ofperson.. - Complex Conditions in JSX [CHECKLIST ITEM #3]: The conditional logic for rendering marriage status (e.g.,
person.isMarried && person.sex === 'm') should be extracted into separate, descriptively named variables before thereturnstatement. This improves readability significantly.
Once these style issues are addressed, your solution will be ready for approval!
✨ 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
src/components/Person/Person.jsx
Outdated
| @@ -1 +1,18 @@ | |||
| // export const Person = ({ person }) => (); | |||
| 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'. While you have correctly destructured the person object from props, you should also destructure the properties within the person object (e.g., name, age, sex). This avoids repeating person. throughout your component and makes the code cleaner.
src/components/Person/Person.jsx
Outdated
| {person.isMarried && | ||
| person.sex === 'm' && |
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'. Instead of chaining multiple conditions with && directly in the JSX, it's better to extract this logic into a descriptive boolean variable. For example: const isMarriedMan = person.isMarried && person.sex === 'm';. The same applies to the condition on lines 13-14.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this iteration! You've effectively addressed the previous feedback, and your solution now meets all the requirements. I am happy to approve your submission.
For future reference, here are a couple of minor style improvements for src/components/Person/Person.jsx:
- The ternary operator should be formatted across multiple lines for better readability, as per [CHECKLIST ITEM #2].
- For consistency, it's best to use the
agevariable you destructured instead of accessingperson.ageagain.
Great job overall!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| : `${partnerName} is my husband`; | ||
| } | ||
|
|
||
| const ageText = age ? `I am ${person.age}` : null; |
There was a problem hiding this comment.
This line has a couple of minor issues:
- According to checklist item Solution #2, this ternary operator should be formatted across multiple lines for better readability.
- You have already destructured
agefrompersonon line 2. For consistency, you should use theagevariable here instead ofperson.age.
DEMO LINK