-
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
'solution' #22
base: master
Are you sure you want to change the base?
'solution' #22
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.
Ну так як я вчора з тоюою над цим сидів, то мені подобається, я приймаю, тільки зверни увагу на коментарі. Молодець!
import PropTypes from 'prop-types'; | ||
|
||
const Todo = ({ todo, toggle, destroyTodo }) => { | ||
const completedStyle = { |
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.
ну бажано виноси це в файл стилів
handleDestroyAllCompletedTodos = () => { | ||
this.setState(prevState => ({ | ||
visibleTodos: prevState.visibleTodos | ||
.filter(todo => todo.completed === 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.
не треба повторювати ту ж дію два рази обчислюй один раз і передавай вже змінну
this.setState(prevState => {
const result = prevState.visibleTodos
.filter(todo => todo.completed === false);
return {
visibleTodos: result,
filteredTodos: result,
}
});
} | ||
|
||
handleDestroyTodo = (id) => { | ||
const updatedTodo = this.state.visibleTodos; |
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.
це не копія
TODO app