-
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 #714
base: master
Are you sure you want to change the base?
solution #714
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.
src/components/TodoApp/TodoApp.tsx
Outdated
}; | ||
|
||
const deleteCompletedHandler = () => { | ||
setTodos(todos.filter(currentTodo => currentTodo.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.
setTodos(todos.filter(currentTodo => currentTodo.completed === false)); | |
setTodos(todos.filter(currentTodo => !currentTodo.completed)); |
src/components/TodoApp/TodoApp.tsx
Outdated
}; | ||
|
||
const completedTodosCounter = useMemo(() => ( | ||
todos.filter(currentTodo => currentTodo.completed === true).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.
todos.filter(currentTodo => currentTodo.completed === true).length | |
todos.filter(currentTodo => currentTodo.completed).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.
Great job overall! Left a few comments to make your code more advanced)
src/components/TodoApp/TodoApp.tsx
Outdated
</form> | ||
</header> | ||
|
||
{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.
{todos.length > 0 && ( | |
{!!todos.length && ( |
src/components/TodoApp/TodoApp.tsx
Outdated
</section> | ||
)} | ||
|
||
{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.
{todos.length > 0 && ( | |
{!!todos.length && ( |
src/components/TodoApp/TodoApp.tsx
Outdated
|
||
<TodosFilter /> | ||
|
||
{completedTodosCounter > 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.
{completedTodosCounter > 0 && ( | |
{!!completedTodosCounter && ( |
DEMO LINK