-
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
Develop #1352
base: master
Are you sure you want to change the base?
Develop #1352
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.
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:
-
Missing
key
Prop in Iteration: TheCommentInfo
component inside the.map
call is missing akey
prop. This is essential for React to efficiently update and render components. -
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. -
Data Structure Verification: Ensure that the JSON files contain the expected data structure. This is critical for the functions
getUserById
andgetCommentsById
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'; |
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 PostList
component is correctly implemented and expects a posts
prop. This is crucial for rendering the list of posts correctly.
import postsFromServer from './api/posts.json'; | ||
import commentsFromServer from './api/comments.json'; | ||
import usersFromServer from './api/users.json'; |
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.
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 }) => { |
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 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 }) => ( |
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 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} /> |
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.
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 }) => { |
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 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 ? ( |
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.
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 }) => ( |
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 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.
src/components/UserInfo/UserInfo.jsx
Outdated
@@ -1 +1,9 @@ | |||
export const UserInfo = () => <>Put the user here</>; | |||
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 contains email
and name
properties. This is crucial for the component to render correctly without errors.
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.
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:
-
Typographical Error: There's a small typo in the function name
preperaPost
. It should be corrected topreparePost
for better readability and to maintain coding standards. -
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. -
Key Prop in Iteration: The
key
prop is correctly implemented in your.map
iterations, ensuring efficient rendering and updating by React. -
Data Structure Verification: Your handling of JSON files to prepare posts by adding
user
andcomments
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 => ({ |
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.
Typographical Error: The function preperaPost
has a typo in its name. It should be preparePost
to reflect proper spelling and maintain code readability.
No description provided.