-
Notifications
You must be signed in to change notification settings - Fork 4
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/nishadi #311
base: main
Are you sure you want to change the base?
react1-week3/nishadi #311
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.
Good job
date.setHours(0, 0, 0, 0) | ||
|
||
if (deadline < date) { | ||
return window.alert('Please select a deadline in present or future') |
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.
Since handleSubmit does not expect a return value, you can rewrite this into:
alert('...');
return;
Here the purpose of the return statement will be simply to stop executing the rest of the function, which is correct.
/> | ||
<br /> | ||
<label >Deadline</label> | ||
<div> |
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 don't need the div here, since it is not doing anything.
|
||
const deadLineText = `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()}` | ||
|
||
const decorateDone = props.done ? |
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 one 👍
} | ||
|
||
return ( | ||
<li key={props.taskId} className="todoItem"> |
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.
As a convention, class names are always written in kebab case (https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case).
); | ||
} | ||
|
||
TodoItem.propTypes = { |
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 one
const onAddNewTask = (description, deadline) => { | ||
const newTask = { | ||
id: new Date().getTime(), | ||
description: description, |
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.
Optional: since both sides are called description
, you can just write it once, i.e. description,
.
Please review my homework.