-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 #1401
base: master
Are you sure you want to change the base?
add task solution #1401
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.
Все добре, але імпорти краще писати у форматі import { CommentInfo } from '../CommentInfo';
замість import { CommentInfo } from '../CommentInfo/**CommentInfo'**;
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 job on meeting the task requirements and structuring your code well! 🎉 While there are some minor issues related to potential null values and prop validation, they don't significantly impact the functionality. Consider adding prop type validation and handling cases where data might be missing to make your code more robust. Keep up the good work! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
|
||
const posts = postsFromServer.map(post => ({ | ||
...post, | ||
user: getUserById(post.userId), |
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.
Ensure that getUserById
returns a valid user object. If usersFromServer
does not contain a user with the given userId
, null
will be assigned to the user
property of a post. Consider handling this case in the UI or by providing a default user object.
const posts = postsFromServer.map(post => ({ | ||
...post, | ||
user: getUserById(post.userId), | ||
comments: getCommentById(post.id), |
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.
The getCommentById
function returns an array of comments. Ensure that the PostList
component can handle posts with an empty comments array if no comments are found for a post.
@@ -1 +1,19 @@ | |||
export const CommentInfo = () => <>Put the comment here</>; | |||
export const CommentInfo = ({ 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.
Ensure that the comment
prop is always provided to the CommentInfo
component. Consider adding prop type validation to ensure comment
has the expected shape, including name
, email
, and body
properties.
import { CommentList } from '../CommentList/CommentList'; | ||
import { UserInfo } from '../UserInfo/UserInfo'; | ||
|
||
export const PostInfo = ({ 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.
Ensure that the post
prop is always provided to the PostInfo
component. Consider adding prop type validation to ensure post
has the expected shape, including title
, body
, user
, and comments
properties.
<p> | ||
{' Posted by '} | ||
|
||
<UserInfo user={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.
Ensure that the user
object passed to the UserInfo
component is not null. If getUserById
returns null, this could lead to rendering issues. Consider handling this case in the UI or by providing a default user object.
export const PostList = () => <>Put the list here</>; | ||
import { PostInfo } from '../PostInfo/PostInfo'; | ||
|
||
export const PostList = ({ posts }) => |
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.
Ensure that the posts
prop is always provided to the PostList
component. Consider adding prop type validation to ensure posts
is an array of objects with the expected structure.
export const UserInfo = () => <>Put the user here</>; | ||
import './UserInfo.scss'; | ||
|
||
export const UserInfo = ({ 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.
Ensure that the user
prop is always provided to the UserInfo
component. Consider adding prop type validation to ensure user
has the expected shape, including name
and email
properties.
DEMO LINK