-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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-todo-form #2912
base: master
Are you sure you want to change the base?
add-todo-form #2912
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 implementation is mostly solid, there's a critical issue with data preparation in the TodoInfo
component that needs to be addressed. According to the task requirements, data should be prepared in the App
component and passed down to child components, rather than importing functions like getUserById
directly in non-root components. This change will enhance the separation of concerns and improve the reusability and testability of your components. Once you make this adjustment, your code will be ready for approval. 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.tsx
Outdated
completed: false, | ||
}; | ||
|
||
setTodos(currentTodos => [...currentTodos, newTodo]); |
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.
According to the checklist, when using non-mutating array methods, you don't need to create a copy of the array. In this case, setTodos(currentTodos => [...currentTodos, newTodo]);
is correct because you're adding a new item to the array, which requires creating a new array. However, ensure this pattern is used only when necessary to avoid unnecessary array copying.
src/components/TodoInfo/TodoInfo.tsx
Outdated
@@ -1 +1,27 @@ | |||
export const TodoInfo = () => {}; | |||
import { getUserById } from '../../services'; |
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.
According to the checklist, you should prepare data in one place (App component) and pass it to child components. Avoid using the import
keyword in non-root components. Instead of calling getUserById
here, consider passing the user data as a prop from the parent component.
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.
Great job on implementing the task! 🎉 Your code mostly meets the requirements, and you've done well in preparing the data in the App
component and passing it down to child components. However, there's a critical issue to address: the NewTodoForm
component should not use the getUserById
function directly. Instead, handle this in the App
component and pass the complete todo object to NewTodoForm
. This will ensure better separation of concerns and adhere to the task requirements. Keep up the good work, and make sure to review the comments to improve your code. Addressing these issues will help you avoid similar problems in the future and enhance your learning experience. 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
<your_account>
with your Github username in the DEMO LINK and add it to the PR description.