-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
react_person solution #1631
base: master
Are you sure you want to change the base?
react_person solution #1631
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.
Small comments
src/App.jsx
Outdated
<p className="Person__age">I am 37</p> | ||
<p className="Person__partner">Natasha is my wife</p> | ||
</section> | ||
<Person person={misha} /> | ||
|
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.
Delete blank lines between components
src/components/Person/Person.jsx
Outdated
return ( | ||
<section className="Person"> | ||
<h2 className="Person__name"> | ||
{`My name is ${person.name}`} |
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.
Use destructuring for all values
src/components/Person/Person.jsx
Outdated
{`My name is ${person.name}`} | ||
</h2> | ||
|
||
{Boolean(person.age) > 0 && ( |
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.
{Boolean(person.age) > 0 && ( | |
{Boolean(person.age) && ( |
src/components/Person/Person.jsx
Outdated
</p> | ||
)} | ||
|
||
<p className="Person__partner">{marriageInformation}</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.
<p className="Person__partner">{marriageInformation}</p> | |
<p className="Person__partner"> | |
{marriageInformation} | |
</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.
Good job!👍
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, but pay attention to the comment.
src/components/Person/Person.jsx
Outdated
const spouseGender = sex === 'm' | ||
? 'wife' | ||
: 'husband'; |
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.
It would be cool to keep such data in separate constants:
const MALE = 'm';
const WIFE = 'wife';
const HUSBAND = 'husband';
...
const spouseGender = sex === MALE
? WIFE
: HUSABAND;
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.
oh, I really didn't see it, sorry, I'll redo it now, thanks
DEMO LINK: https://Vitalii-Petruk.github.io/react_person/