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

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

Develop #2925

wants to merge 3 commits into from

Conversation

maksym2493
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 implementing the task requirements! 🎉 While there are a few minor improvements suggested, such as handling undefined users and improving variable naming, these do not critically impact the functionality. Keep up the good work and consider these suggestions for future enhancements! 😊

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

src/App.tsx Outdated

export const App = () => {
const [todos, setTodos] = useState([...initialTodos]);

Choose a reason for hiding this comment

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

Using useState([...initialTodos]) is unnecessary because initialTodos is already a new array. You can simply use useState(initialTodos).

import { TodoList } from './components/TodoList';

function findUserById(userId: number): User | undefined {
return usersFromServer.find(user => user.id === userId);

Choose a reason for hiding this comment

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

The findUserById function returns undefined if no user is found. Ensure that this case is handled appropriately in your application, especially when rendering components that depend on the user object.

Choose a user
</option>

{users.map(u => (

Choose a reason for hiding this comment

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

Avoid using one-letter variable names like u. Instead, use more descriptive names such as user to improve code readability. This aligns with the checklist item: "Don't use one-letter variable naming."

};

return (
<form action="/api/todos" method="POST" onSubmit={handleSubmit}>

Choose a reason for hiding this comment

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

The action attribute in the form tag might not be necessary if you are handling form submission entirely with JavaScript. Consider removing it if it's not needed.

>
<h2 className="TodoInfo__title">{todo.title}</h2>

<UserInfo user={todo.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 property passed to UserInfo is not null or undefined before rendering. This aligns with the checklist item: "Don't render the component if the property that you pass to the component has null or undefined value." Consider adding a conditional check before rendering UserInfo.

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