-
Notifications
You must be signed in to change notification settings - Fork 1
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
react1-week3/yousseftopaji #283
base: main
Are you sure you want to change the base?
Conversation
…e-CPH/class27-homework into react1-week3/yousseftopaji
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.
Well done @yousseftopaji 👏 I left few comments, but overall very good.
Just next time please push only the relevant parts of code, so it's clear what is a part of the assignment and whats not. :) Thank you
|
||
const handleUpdate = () => { | ||
if (newDescription.trim()) { | ||
if (todo.deadline && new Date(todo.deadline) < new Date()) { |
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.
I do not think it is necessary to check the deadline
if you want to change just the description and not the deadline
itself, also right now if you try to edit an element with the deadline in past, there is no other choice than delete the element otherwise you got stuck
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.
Also I think you were supposed to update all todo's props deadline
included
const [deadline, setDeadline] = useState(null); | ||
|
||
useEffect(() => { | ||
fetch( |
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.
although not an issue it's not a good practice to have an anonymous function inside of the useEffect
hook
you can assign the fetch logic to a variable (e.g fetchAndSetTodos) and call it afterward inside of the hooks :)
<h1>Todo List</h1> | ||
{todos.length === 0 ? ( | ||
<> | ||
{" "} |
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.
you can delete this line :)
No description provided.