-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 #2012
base: master
Are you sure you want to change the base?
add task solution #2012
Conversation
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.
Great work but you forgot to import styles ;)
src/App.tsx
Outdated
<div className="PostInfo"> | ||
<div className="PostInfo__header"> | ||
<h3 className="PostInfo__title">doloremque illum aliquid sunt</h3> | ||
function getUser(userId: number): User | null { |
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.
If you are searching some entity by some filter, specify it in function/method name [checklist]
function getUser(userId: number): User | null { | |
function getUserById(userId: number): User | null { |
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.
Well done. For future reference, whenever there is an opportunity to use destructuring, do so. By using destructuring, you can write cleaner, more readable, and maintainable code. It is a valuable tool in modern JavaScript development.
type Props = { | ||
comment: Comment; | ||
}; | ||
export const CommentInfo: React.FC<Props> = ({ comment }) => ( |
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.
Use destructuring whenever you are able to.
post: Post; | ||
}; | ||
|
||
export const PostInfo: React.FC<Props> = ({ post }) => ( |
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 post
could also be destructured.
user: User; | ||
}; | ||
|
||
export const UserInfo: React.FC<Props> = ({ user }) => ( |
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.
Same here.
DEMO LINK