Skip to content

add task solution#3762

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

add task solution#3762
vitamartsekhovska wants to merge 1 commit into
mate-academy:masterfrom
vitamartsekhovska:develop

Conversation

@vitamartsekhovska
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 is working correctly and meets all functional requirements. The component properly renders person details, handles conditional age display, uses correct terminology for married status, and passes the entire person object as a prop. The code is functional and produces the expected output. However, there are two style improvements to consider for better code quality. First, [CHECKLIST ITEM #1] recommends destructuring all individual properties directly from props rather than accessing them through the person object — currently you access person.name, person.age, etc., when you could destructure them at the component level. Second, [CHECKLIST ITEM #3] suggests extracting conditional expressions to named variables before using them in JSX — for example, extracting person.age into const hasAge before the conditional render on line 17. These are code style improvements rather than critical issues, so your solution is approved. Addressing the checklist items will improve readability and make your code more aligned with project conventions.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment on lines +13 to +15
export const Person = ({ person }) => (
<section className="Person">
<h2 className="Person__name">{`My name is ${person.name}`}</h2>
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. While person is destructured from props, the individual properties (name, age, sex, isMarried, partnerName) are accessed directly without destructuring. Consider destructuring these values directly from props for better code clarity.

<section className="Person">
<h2 className="Person__name">{`My name is ${person.name}`}</h2>

{person.age && <p className="Person__age">{`I am ${person.age}`}</p>}
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 condition person.age && <p> is placed directly in JSX. Consider extracting it to a variable first, like const hasAge = person.age and then using {hasAge && <p>...</p>}.

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