Skip to content

add task solution#3764

Open
lucashel-design wants to merge 2 commits into
mate-academy:masterfrom
lucashel-design:develop
Open

add task solution#3764
lucashel-design wants to merge 2 commits into
mate-academy:masterfrom
lucashel-design:develop

Conversation

@lucashel-design
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread src/components/Person/Person.jsx Outdated
Comment on lines +7 to +16
<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`}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/App.jsx
@@ -1,5 +1,6 @@
import React from 'react';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants