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

Develop #1352

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

Develop #1352

wants to merge 3 commits into from

Conversation

Valbel93
Copy link

No description provided.

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.


Thank you for your hard work on this project! 😊 While your code is mostly well-implemented, there are a few critical issues that need to be addressed to meet the core requirements of the task:

  1. Missing key Prop in Iteration: The CommentInfo component inside the .map call is missing a key prop. This is essential for React to efficiently update and render components.

  2. Separation of Styles: The task requires that styles from App.scss be moved to separate component-specific files. This separation is crucial for maintaining a clean and organized codebase.

  3. Data Structure Verification: Ensure that the JSON files contain the expected data structure. This is critical for the functions getUserById and getCommentsById to work correctly.

Please address these issues to ensure the functionality and maintainability of your code. Once these changes are made, your code will be in great shape! Keep up the great work! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review button in the Reviewers tab.

src/App.jsx Outdated
@@ -1,104 +1,27 @@
import './App.scss';
import { PostList } from './components/PostList';

Choose a reason for hiding this comment

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

Ensure that the PostList component is correctly implemented and expects a posts prop. This is crucial for rendering the list of posts correctly.

Comment on lines +4 to +6
import postsFromServer from './api/posts.json';
import commentsFromServer from './api/comments.json';
import usersFromServer from './api/users.json';

Choose a reason for hiding this comment

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

Verify that the JSON files (posts.json, comments.json, users.json) contain the expected data structure. The functions getUserById and getCommentsById rely on these structures to function correctly.

export const CommentInfo = () => <>Put the comment here</>;
import './CommentInfo.scss';

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 passed to CommentInfo contains name, email, and body properties. This is crucial for the component to render correctly without errors.

import { CommentInfo } from '../CommentInfo';
import './CommentList.scss';

export const CommentList = ({ comments }) => (

Choose a reason for hiding this comment

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

Ensure that the comments prop is an array of comment objects. Each object should have the necessary properties expected by the CommentInfo component.

export const CommentList = ({ comments }) => (
<div className="CommentList">
{comments.map(comment => (
<CommentInfo comment={comment} />

Choose a reason for hiding this comment

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

Consider adding a key prop to the CommentInfo component to help React identify which items have changed, are added, or are removed. This is important for performance and avoiding potential issues with component re-rendering.

import { UserInfo } from '../UserInfo';
import './PostInfo.scss';

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 contains title, user, body, and comments properties. This is crucial for the component to render correctly without errors.

</p>
</div>
<p className="PostInfo__body">{body}</p>
{comments.length ? (

Choose a reason for hiding this comment

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

Consider checking if comments is an array before accessing comments.length to avoid potential runtime errors if comments is undefined or not an array.

export const PostList = () => <>Put the list here</>;
import { PostInfo } from '../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 an array of post objects with unique id properties. This is crucial for the key prop to work correctly and for the component to render without errors.

@@ -1 +1,9 @@
export const UserInfo = () => <>Put the user here</>;
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 contains email and name properties. This is crucial for the component to render correctly without errors.

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.

Review Summary

Great job on your submission! 🎉 Your code is mostly well-structured and meets the task requirements. Here are a few points to consider for improvement:

  1. Typographical Error: There's a small typo in the function name preperaPost. It should be corrected to preparePost for better readability and to maintain coding standards.

  2. Separation of Styles: You've successfully moved styles from App.scss to separate component-specific files, which is crucial for maintaining a clean and organized codebase.

  3. Key Prop in Iteration: The key prop is correctly implemented in your .map iterations, ensuring efficient rendering and updating by React.

  4. Data Structure Verification: Your handling of JSON files to prepare posts by adding user and comments is well-executed.

The decision to APPROVE your pull request is made to help you move forward with your learning. Please review the comments to improve your code further. Remember, addressing critical issues like typographical errors is important for the functionality and maintainability of your code. Keep up the good work and continue to learn from these experiences! 🚀

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

import usersFromServer from './api/users.json';
import { PostList } from './components/PostList';

export const preperaPost = postsFromServer.map(posts => ({

Choose a reason for hiding this comment

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

Typographical Error: The function preperaPost has a typo in its name. It should be preparePost to reflect proper spelling and maintain code readability.

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.

2 participants