-
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 #1559
base: master
Are you sure you want to change the base?
react person #1559
Conversation
src/components/Person/Person.jsx
Outdated
{person.isMarried === true ? ( | ||
`${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` | ||
) : ( | ||
'I am not married' | ||
)} |
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.
- move this conditions to a variable to increase readability
person.isMarried === true ?
is the same as justperson.isMarried ?
src/components/Person/Person.jsx
Outdated
export const Person = ({ 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.
it's a good practice to use object destructing
export const Person = ({ person }) => ( | |
<section className="Person"> | |
export const Person = ({ person }) => { | |
const {...} = person | |
return ( | |
<section className="Person"> |
src/App.jsx
Outdated
<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.
no needs to write from a new line since you have only one prop
.
Apply for other cases below
<Person | |
person={misha} | |
/> | |
<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.
You've got this, keep pushing forward!
DEMO LINK