Skip to content

add task solution#3760

Open
galina-palyukh wants to merge 1 commit into
mate-academy:masterfrom
galina-palyukh:develop
Open

add task solution#3760
galina-palyukh wants to merge 1 commit into
mate-academy:masterfrom
galina-palyukh:develop

Conversation

@galina-palyukh
Copy link
Copy Markdown

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 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]:

  1. Props destructuring — In Person.jsx, destructure the person object at the component level:

    const Person = ({ person }) => {
      const { name, age, sex, isMarried, partnerName } = person;
      // ...
    };
  2. 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

  1. Rate AI review example

// export const Person = ({ person }) => ();
import './Person.scss';

export const Person = ({ person }) => (
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 #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.

Comment on lines +8 to +10
<p className="Person__partner">
{person.isMarried
? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : '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. The nested ternary person.sex === 'm' ? 'wife' : 'husband' should be extracted to a separate variable before the return statement.

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