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

v1 #1199

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

v1 #1199

Conversation

Daryna-Kukharets
Copy link

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 your submission! 🎉 Your code meets most of the task requirements and constraints, and it's clear you've put a lot of effort into following best practices. Here are a few areas to focus on for improvement:

  1. PropTypes: Consider adding propTypes definitions for your components to ensure type-checking of props in React.

  2. Error Handling: Implement retry logic for adding and deleting comments to enhance user experience.

  3. State Initialization with Props: Avoid initializing state directly with props to prevent unexpected behavior.

  4. Unused Comments: Clean up any commented-out code or unnecessary comments to maintain code clarity.

  5. Key Generation: Ensure stable keys for list items, avoiding dynamic generation during render.

These improvements will help you refine your skills and produce even more robust code. Keep up the great work, and continue learning from these experiences! 🚀

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

Copy link

@volodymyr-soltys97 volodymyr-soltys97 left a comment

Choose a reason for hiding this comment

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

Good job 👍
Let's improve your code

src/App.tsx Outdated
<div className="block" data-cy="MainContent">
<p data-cy="NoSelectedUser">No user selected</p>
useEffect(() => {
getUsers().then(fetchedUsers => setUsers(fetchedUsers));

Choose a reason for hiding this comment

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

Suggested change
getUsers().then(fetchedUsers => setUsers(fetchedUsers));
getUsers()
.then(setUsers);

Comment on lines 31 to 39
<tr data-cy="Post" key={post.id}>
<td data-cy="PostId">{post.id}</td>

<td data-cy="PostTitle">{post.title}</td>

<td className="has-text-right is-vcentered">
<button
type="button"
data-cy="PostButton"

Choose a reason for hiding this comment

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

Move this logic to the PostItem component

<tr data-cy="Post" key={post.id}>
<td data-cy="PostId">{post.id}</td>

<td data-cy="PostTitle">{post.title}</td>

Choose a reason for hiding this comment

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

Use destructuring for post

Comment on lines 43 to 49
onClick={() => {
if (selectedPost?.id === post.id) {
setSelectedPost(null);
} else {
setSelectedPost(post);
}
}}

Choose a reason for hiding this comment

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

Move this logic from jsx to the helper function and use it here

src/App.tsx Outdated
</div>
)}

{!error && selectedUser && posts.length > 0 && !loading && (

Choose a reason for hiding this comment

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

Suggested change
{!error && selectedUser && posts.length > 0 && !loading && (
{!error && selectedUser && !!posts.length && !loading && (

Copy link

@anastasiiavorobiova anastasiiavorobiova left a comment

Choose a reason for hiding this comment

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

Great work!

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.

4 participants