-
Notifications
You must be signed in to change notification settings - Fork 3.5k
add task solution #3740
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
base: master
Are you sure you want to change the base?
add task solution #3740
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import React from 'react'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CHECKLIST ITEM #1] This destructures only |
||
| import './App.scss'; | ||
| import { Person } from './components/Person/Person'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CHECKLIST ITEM #1] Use destructured |
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CHECKLIST ITEM #1] Use destructured |
||
| export const misha = { | ||
| name: 'Misha', | ||
|
|
@@ -25,21 +26,8 @@ export const alex = { | |
|
|
||
| export const App = () => ( | ||
| <div className="App"> | ||
| <section className="Person"> | ||
| <h2 className="Person__name">My name is Misha</h2> | ||
| <p className="Person__age">I am 37</p> | ||
| <p className="Person__partner">Natasha is my wife</p> | ||
| </section> | ||
|
|
||
| <section className="Person"> | ||
| <h2 className="Person__name">My name is Olya</h2> | ||
| <p className="Person__partner">Maksym is my husband</p> | ||
| </section> | ||
|
|
||
| <section className="Person"> | ||
| <h2 className="Person__name">My name is Alex</h2> | ||
| <p className="Person__age">I am 25</p> | ||
| <p className="Person__partner">I am not married</p> | ||
| </section> | ||
| <Person person={misha} /> | ||
| <Person person={olya} /> | ||
| <Person person={alex} /> | ||
| </div> | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,11 @@ | ||
| // export const Person = ({ person }) => (); | ||
| export const Person = ({ person }) => ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checklist item #1 violation: Use destructuring for accessing individual values. Destructure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CHECKLIST ITEM #1] Instead of accessing |
||
| <section className="Person"> | ||
| <h2 className="Person__name">My name is {person.name}</h2> | ||
| {person.age && <p className="Person__age">I am {person.age}</p>} | ||
| <p className="Person__partner"> | ||
| {person.isMarried | ||
| ? `${person.partnerName} is my ${person.sex === 'm' ? 'wife' : 'husband'}` | ||
| : 'I am not married'} | ||
|
Comment on lines
+6
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [CHECKLIST ITEM #2] Format ternary operands correctly - move each operand to a separate line with proper indentation. |
||
| </p> | ||
| </section> | ||
| ); | ||
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.
This violates checklist item #1: Use destructuring for getting access to values of
propsobject. The component should destructure all properties from the person object (name, age, isMarried, partnerName, sex) rather than accessing them viaperson.xxxthroughout the component.