-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Complete Task #1546
base: master
Are you sure you want to change the base?
Complete Task #1546
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 👍
Let's improve your code
onClick={e => { | ||
e.preventDefault(); | ||
deleteCompletedTodos(); | ||
}} |
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.
onClick={e => { | |
e.preventDefault(); | |
deleteCompletedTodos(); | |
}} | |
onClick={deleteCompletedTodos} |
onClick={() => { | ||
completeFunc(); | ||
}} |
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.
onClick={() => { | |
completeFunc(); | |
}} | |
onClick={completeFunc} |
<button | ||
type="button" | ||
className={classNames('todoapp__toggle-all', { | ||
active: todos.filter(todo => !todo.completed).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.
Move this logic from jsx to the helper variable and use it here
onKeyDown={e => { | ||
if (e.key === 'Enter') { | ||
e.preventDefault(); | ||
createFunc(); |
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.
Use a more descriptive name for all functions, for example you here you can use handleCreateTodo
createFunc(); | |
handleCreateTodo(); |
type="checkbox" | ||
className="todo__status" | ||
checked={currentTodo.completed} | ||
onChange={() => setTodoCompleted()} |
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.
Fix it everywhere
onChange={() => setTodoCompleted()} | |
onChange={setTodoCompleted} |
DEMO LINK