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

Solution #1592

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

Solution #1592

wants to merge 3 commits into from

Conversation

Oleh0293
Copy link

Copy link

@polosanya polosanya left a comment

Choose a reason for hiding this comment

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

Almost perfect!

Comment on lines 4 to 8
const { name,
age,
sex,
isMarried,
partnerName } = person;

Choose a reason for hiding this comment

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

Suggested change
const { name,
age,
sex,
isMarried,
partnerName } = person;
const {
name,
age,
sex,
isMarried,
partnerName,
} = person;

sex,
isMarried,
partnerName } = person;
const partnerDesignation = sex === 'm'

Choose a reason for hiding this comment

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

Suggested change
const partnerDesignation = sex === 'm'
const partner = sex === 'm'

You can simplify the variable's name

return (
<section className="Person">
<h2 className="Person__name">{`My name is ${name}`}</h2>
{person.age && (<p className="Person__age">{`I am ${age}`}</p>)}

Choose a reason for hiding this comment

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

It's not critical, but you could check if the age is a positive number

Comment on lines 15 to 16
<h2 className="Person__name">{`My name is ${name}`}</h2>
{person.age && (<p className="Person__age">{`I am ${age}`}</p>)}

Choose a reason for hiding this comment

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

Suggested change
<h2 className="Person__name">{`My name is ${name}`}</h2>
{person.age && (<p className="Person__age">{`I am ${age}`}</p>)}
<h2 className="Person__name">
{`My name is ${name}`}
</h2>
{person.age && (
<p className="Person__age">
{`I am ${age}`}
</p>
)}

Such formatting will make your code easier to read

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

{person.age && (

Choose a reason for hiding this comment

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

why use person.age here? just use age ;)

btw, I guess if age is gonna be 0 it's not gonna work correctly, I mean age 0 is not correctly itself, but react will probably just render '0' on the page, so we have to convert it to boolean to make sure it works just fine, we can achieve it by using !! or Boolean

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