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

add task solution #1610

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

add task solution #1610

wants to merge 4 commits into from

Conversation

Vannnkof
Copy link

Comment on lines 18 to 20
{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.

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

Comment on lines 22 to 30
{isMarried ? (
<p className="Person__partner">
{`${partnerName} is my ${sex === SEX_MALE
? 'wife'
: 'husband'}`}
</p>
) : (
<p className="Person__partner">I am not married</p>
)}

Choose a reason for hiding this comment

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

let's write ternary inside of

tag

  • let's create variable to get rid of inner ternary

@Vannnkof Vannnkof requested a review from tiserett August 22, 2023 15:29
Comment on lines 22 to 26
{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.

Will be better to use Boolean() check and use && operator instead of ternary one

: null}

{isMarried ? (
<p className="Person__partner">

Choose a reason for hiding this comment

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

The outer paragraph is the same for both cases
Don't repeat yourself
Let's change only the paragraph content depending on the variable value

Copy link

@roman-mirzoian roman-mirzoian 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 +28 to +32
<p className="Person__partner">
{isMarried
? messageAboutPartner
: messageAboutFreedom}
</p>

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">
{isMarried
? messageAboutPartner
: messageAboutFreedom}
</p>
<p className="Person__partner">
{isMarried
? messageAboutPartner
: messageAboutFreedom
}
</p>

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.

4 participants