Skip to content
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_solituon #1834

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

anastasiia-burkovska
Copy link

Comment on lines 1 to 4
export const Person = ({
person,
}) => (
<section className="Person">

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

Suggested change
export const Person = ({
person,
}) => (
<section className="Person">
export const Person = ({ person }) => {
const { name, age, ... } = person;
return (
<section className="Person">

}) => (
<section className="Person">
<h2 className="Person__name">
{`My name is ${person.name}`}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no needs to use a template string

Suggested change
{`My name is ${person.name}`}
My name is {name}

{`My name is ${person.name}`}
</h2>

{person.age ? <p className="Person__age">{`I am ${person.age}`}</p> : null }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use &&

Suggested change
{person.age ? <p className="Person__age">{`I am ${person.age}`}</p> : null }
{age && <p className="Person__age">I am {person.age}</p> }

Comment on lines 12 to 14
{person.isMarried
? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}`
: 'I am not married'}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use destructed values

Copy link

@loralevitska loralevitska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done)

Comment on lines +13 to +14
{isMarried
? `${partnerName} is my ${sex === 'm' ? 'wife' : 'husband'}`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid nesting ternary
Make a variable for this expression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants