-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
todo app #674
base: master
Are you sure you want to change the base?
todo app #674
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.
src/components/TodoItem/TodoItem.tsx
Outdated
if (value) { | ||
updateTodoTitle(); | ||
setIsEditable(false); | ||
} else { | ||
deleteTodo(); | ||
setIsEditable(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.
if (value) { | |
updateTodoTitle(); | |
setIsEditable(false); | |
} else { | |
deleteTodo(); | |
setIsEditable(false); | |
} | |
}; | |
value ? updateTodoTitle() : deleteTodo(); | |
setIsEditable(false); | |
}; |
src/components/TodoItem/TodoItem.tsx
Outdated
if (e.key === 'Enter') { | ||
handleEdit(e.target.value); | ||
} | ||
|
||
if (e.key === 'Escape') { | ||
setIsEditable(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.
it's better to use switch case statement here
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.
good job
DEMO LINK