-
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 #7
base: master
Are you sure you want to change the base?
solution #7
Conversation
src/App/App.js
Outdated
this.setState({ ...state }); | ||
} | ||
|
||
componentWillUpdate(nextProps, nextState, nextContext) { |
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/App/App.js
Outdated
} | ||
|
||
changeFilter = async(e) => { | ||
console.log(e.target); |
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/App/App.js
Outdated
filterValue = filterValue[1]; | ||
} else { | ||
filterValue = ''; | ||
} |
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.
если ты уже начал парсить href
то пора использовать React Router
src/App/App.js
Outdated
status = true; | ||
break; | ||
case 'active': | ||
status = 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.
чем создавать переменную проще тут сделать return
того что нужно
Может добавится больше фильтров или логика изменится
Да и нагляднее будет - что именно возвращаем в каждом случае когда
src/App/App.js
Outdated
const index = todosList.findIndex(todo => todo.id === id); | ||
const togle = !todosList[index].completed; | ||
|
||
todosList[index].completed = togle; |
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.
const todos = prevState.todos.map(todo => {
if (todo.id !== id) {
return todo;
}
return {
...todo,
completed: !todo.completed,
};
});
const completedTodos = todos.filter(todo => todo.completed)
return { todos, completedLength: completedTodos.length };
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/App/App.js
Outdated
}; | ||
}); | ||
|
||
completedLength = togle ? prevState.todosList.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.
простота поддержки иногда важнее производительности
https://zoom.us/recording/share/0toADjnabJSYr5BrwhxuYQ8YXxuXzjke_u7ga_mD7cawIumekTziMw
src/App/App.js
Outdated
const list = [...prevState.todosList]; | ||
list.push(todoItem); | ||
return { todosList: list, inputValue: '' }; | ||
}); |
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.
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.
Всё досмотреть не успеваю
Внеси пожалуйста правки (и по другим моим видеоразборам изhttps://www.youtube.com/watch?v=EwHQ8MrrANE&list=PL7FuXFaDeEX3AbsSUG1LvTr8UF5UvKatw)
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 то він має пропадати, а він не прорадає.
А так дуже крута робота:)
{ | ||
todosLength > 0 && ( | ||
<> | ||
<TodoList filter={params.filter} /> |
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.
ToDoList in heder? footer in heder???
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.
Heder их не оборачивает
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.
Пофиксил баг в инпуте
DEMO