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 #1401

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

Conversation

maponomarenko
Copy link

Copy link

@SofiiaPelenska SofiiaPelenska left a 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'**;

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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),

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),

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 }) => {

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 }) => {

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} />

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 }) =>

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 }) => {

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.

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