-
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
my solution #1052
base: master
Are you sure you want to change the base?
my solution #1052
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
It is a bad practice to write so much code in one place, you need to separate the logic into different components, for example Header, TodoItem, TodoList, Footer
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/Header/header.tsx
Outdated
|
||
return ( | ||
<header className="todoapp__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/Header/header.tsx
Outdated
<button | ||
type="button" | ||
className={classNames('todoapp__toggle-all', { | ||
active: todos.length > 0 && todos.every(todo => todo.completed), |
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 to the helper variable and use it here
src/components/TodoItem/todoItem.tsx
Outdated
/> | ||
</label> | ||
<span data-cy="TodoTitle" className="todo__title"> | ||
{todo.title} |
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 destructuring for todo
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 work! Consider adding an empty array to the ls when the app is loaded to pass the test
I am passing the tests locally, I am attaching a screenshot. And also when loading the page in my Ls is empty. |
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 work! 🔥
DEMO LINK