-
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 #1043
base: master
Are you sure you want to change the base?
solution #1043
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.
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 make your code better
src/App.tsx
Outdated
{!!todos.length && ( | ||
<footer className="todoapp__footer" data-cy="Footer"> | ||
<span className="todo-count" data-cy="TodosCounter"> | ||
{`${activeTodos.length} item${activeTodos.length !== 1 ? 's' : ''} left`} |
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
src/components/TodoFilter.tsx
Outdated
{filterParams.map(param => { | ||
return ( | ||
<a |
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.
{filterParams.map(param => { | |
return ( | |
<a | |
{filterParams.map(param => ( | |
<a |
src/services/TodoService.ts
Outdated
case 'Active': | ||
return todos.filter(todo => !todo.completed); | ||
case 'Completed': | ||
return todos.filter(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.
Create a enum for 'All', 'Active', 'Completed' and use it everywhere
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.
lgtm 🚀
DEMO LINK