Completed the component html and showed the data based on the require…#3729
Completed the component html and showed the data based on the require…#3729ValyaMeln wants to merge 1 commit into
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation meets all functional requirements correctly — the Person component renders three times with proper props, handles optional age appropriately, and displays correct partner titles ('wife'/'husband'). The code works as expected with no broken functionality.
The review identified some code style improvements, such as extracting the nested ternary to a variable like const partnerTitle = person.sex === 'm' ? 'wife' : 'husband'; for readability, and formatting ternary operands on separate lines. These are readability enhancements rather than functional issues, and won't affect the task outcomes.
Great work on fulfilling all the core requirements — your solution is approved.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| {person.isMarried | ||
| ? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` |
There was a problem hiding this comment.
Checklist item #2 violation: Format ternary operator operands correctly - move each operand to the separate line. Current: ? 'wife' : 'husband' should be on separate lines following the GOOD EXAMPLE pattern.
| {person.isMarried | ||
| ? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` |
There was a problem hiding this comment.
Checklist item #3 violation: Avoid putting several cases to conditional rendering. The nested ternary checking person.sex === 'm' should be extracted to a separate variable (e.g., const partnerTitle = person.sex === 'm' ? 'wife' : 'husband';) for better readability.
| import './App.scss'; | ||
| import { Person } from './components/Person/Person'; | ||
|
|
||
| export const misha = { |
There was a problem hiding this comment.
Checklist item #1 violation: Use destructuring for getting access to values of props object. Currently accessing person.name, person.age, person.isMarried, person.partnerName, person.sex directly. Destructure these properties from person object for cleaner code.
| } | ||
|
|
There was a problem hiding this comment.
This violates checklist item #3: avoid putting several cases in conditional rendering. The nested ternary person.sex === 'm' ? 'wife' : 'husband' is hard to read inside the ternary. Extract this into a separate variable before the JSX for better readability.
…ments
https://ValyaMeln.github.io/react_person/