-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
solution #2739
base: master
Are you sure you want to change the base?
solution #2739
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.
Great job on your implementation! 🎉 Your code is well-structured and meets most of the task requirements. There are a few minor improvements you could consider, such as adding error handling for the getUser
and getTodos
functions to prevent unhandled promise rejections. Additionally, reviewing the default values for onSelectTodo
, onQuery
, and onSelectOption
could help avoid unexpected behavior. Keep up the excellent work and continue refining your skills! 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
getTodos() | ||
.then(setTodos) | ||
.finally(() => setIsLoading(false)); |
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 error handling for the getTodos
promise. Currently, if the promise is rejected, it will not be caught, which could lead to unhandled promise rejections. You can add a .catch()
block to handle any errors that might occur during the fetching of todos.
onQuery = () => {}, | ||
onSelectOption = () => {}, |
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.
The default values for onQuery
and onSelectOption
are set to empty functions. This might lead to unexpected behavior if these props are not provided by the parent component. Consider making these props required by removing the default values or ensuring that the parent component always provides these functions.
export const TodoList: React.FC<Props> = ({ | ||
todos, | ||
selectedTodo, | ||
onSelectTodo = () => {}, |
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.
The default value for onSelectTodo
is set to an empty function. This might lead to unexpected behavior if this prop is not provided by the parent component. Consider making this prop required by removing the default value or ensuring that the parent component always provides this function.
|
||
export const TodoModal: React.FC<Props> = ({ | ||
selectedTodo, | ||
onSelectTodo = () => {}, |
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.
The default value for onSelectTodo
is set to an empty function. This might lead to unexpected behavior if this prop is not provided by the parent component. Consider making this prop required by removing the default value or ensuring that the parent component always provides this function.
getUser(selectedTodo.userId) | ||
.then(setUser) | ||
.finally(() => setIsLoading(false)); |
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 error handling for the getUser
promise. Currently, if the promise is rejected, it will not be caught, which could lead to unhandled promise rejections. You can add a .catch()
block to handle any errors that might occur during the fetching of user data.
DEMO LINK