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

finish solution #1619

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

Conversation

serkrops
Copy link


export const Person = (props) => {
const { name, age, sex, isMarried, partnerName } = props.person;
let partner = `I am not married`;

Choose a reason for hiding this comment

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

It's not clear why not marriage info string is stored in partner variable
Check please variable name

Comment on lines 20 to 22
{age
? <p className="Person__age">{`I am ${age}`}</p>
: null }

Choose a reason for hiding this comment

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

It's redundant to use null here
Rewrite it using && operator

Copy link

@Moroz-Dmytro Moroz-Dmytro left a comment

Choose a reason for hiding this comment

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

Small comments below

Comment on lines 5 to 6
export const Person = (props) => {
const { name, age, sex, isMarried, partnerName } = props.person;

Choose a reason for hiding this comment

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

Suggested change
export const Person = (props) => {
const { name, age, sex, isMarried, partnerName } = props.person;
export const Person = ({ person }) => {
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.

We can use destructuring for props. Also pay attention to good formatting

Comment on lines 19 to 20
</h2>
{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>
{age && <p className="Person__age">{`I am ${age}`}</p>}
</h2>
{!!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 is easier to read. Also if age=0 we will see 0 on the page. !! solves this problem

{`My name is ${name}`}
</h2>
{age && <p className="Person__age">{`I am ${age}`}</p>}
<p className="Person__partner">

Choose a reason for hiding this comment

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

Suggested change
<p className="Person__partner">
<p className="Person__partner">

Copy link

@Moroz-Dmytro Moroz-Dmytro left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines 25 to 26
</h2>
{!!age && (

Choose a reason for hiding this comment

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

Suggested change
</h2>
{!!age && (
</h2>
{!!age && (

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