-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #2694
base: master
Are you sure you want to change the base?
Solution #2694
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! 🎉 Your implementation meets all the task requirements and constraints perfectly. The components are well-structured, and you've handled props and conditional rendering effectively. Keep up the excellent work! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work 👍
Let's try to simplify a bit
src/App.jsx
Outdated
|
||
<section className="Person"> | ||
{/* <section className="Person"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all comments
src/components/Person/Person.jsx
Outdated
@@ -1 +1,24 @@ | |||
// export const Person = ({ person }) => (); | |||
export const Person = ({ person }) => { | |||
let marriedLabel = <p className="Person__partner">I am not married</p>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have <p className="Person__partner">
in all cases
src/components/Person/Person.jsx
Outdated
if (person.sex === 'm' && person.isMarried) { | ||
marriedLabel = ( | ||
<p className="Person__partner">{person.partnerName} is my wife</p> | ||
); | ||
} | ||
|
||
if (person.sex === 'f' && person.isMarried) { | ||
marriedLabel = ( | ||
<p className="Person__partner">{person.partnerName} is my husband</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to simplify to avoid repeating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done 🔥
<h2 className="Person__name">My name is {person.name}</h2> | ||
{person.age && <p className="Person__age">I am {person.age}</p>} | ||
<p className="Person__partner">{marriedLabel}</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget about indents(more readable)
<h2 className="Person__name">My name is {person.name}</h2> | |
{person.age && <p className="Person__age">I am {person.age}</p>} | |
<p className="Person__partner">{marriedLabel}</p> | |
<h2 className="Person__name">My name is {person.name}</h2> | |
{person.age && ( | |
<p className="Person__age">I am {person.age}</p> | |
)} | |
<p className="Person__partner">{marriedLabel}</p> |
DEMO LINK