Skip to content

Implement person component#3785

Open
nibretu wants to merge 2 commits into
mate-academy:masterfrom
nibretu:implement-person-component
Open

Implement person component#3785
nibretu wants to merge 2 commits into
mate-academy:masterfrom
nibretu:implement-person-component

Conversation

@nibretu

@nibretu nibretu commented Jun 27, 2026

Copy link
Copy Markdown

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review Summary

I am approving your solution because all core functional requirements are correctly implemented: Person is used three times in App, the full person object is passed as a prop, age is conditionally omitted when missing, and the marriage text and class names behave exactly as specified. The only remaining issue is a checklist-related style point in src/components/Person/Person.jsx where the age conditional rendering is written inline as {age !== undefined && <p className="Person__age">Age: {age}</p>}; this technically violates [CHECKLIST ITEM #3], which asks for a separate variable for multi-part conditions. However, this is a readability/style concern rather than a functional blocker, and it does not break any required behavior, so it doesn't prevent task completion.

If you want to fully align with the checklist, you can do something like:

const hasAge = age !== undefined;
...
{hasAge && (
  <p className="Person__age">Age: {age}</p>
)}

Every other aspect of the component — prop destructuring, conditional partner text, and optional age handling — is well done, so overall this is a solid implementation.


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

Footnotes

  1. Rate AI review example

return (
<section className="Person">
<h2 className="Person__name">My name is {name}</h2>
{age !== undefined && <p className="Person__age">I am {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. Currently, {age !== undefined && <p ...>} combines the condition and rendering inline; consider extracting const hasAge = age !== undefined; and then using {hasAge && ...} to comply with the guideline.

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