-
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
Solution #1511
base: master
Are you sure you want to change the base?
Solution #1511
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.
A little more and it will be completed
src/components/Person/Person.jsx
Outdated
{(() => { | ||
if (person.isMarried) { | ||
return person.sex === 'm' | ||
? `${person.partnerName} is my wife` | ||
: `${person.partnerName} is my husband`; | ||
} | ||
|
||
return '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.
Avoid ternary nesting (even if you used if
instead of one). Move this expression (person.sex === 'm'
? ${person.partnerName} is my wife
: ${person.partnerName} is my husband
;) to variable, and then use interpolation
{(() => { | |
if (person.isMarried) { | |
return person.sex === 'm' | |
? `${person.partnerName} is my wife` | |
: `${person.partnerName} is my husband`; | |
} | |
return 'I am not married'; | |
})()} | |
{person.isMarried ? yourAwesomeVariableName : '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.
You've got this, keep pushing forward!
https://reseneweb.github.io/react_person/