-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Develop #1731
base: master
Are you sure you want to change the base?
Develop #1731
Conversation
handleFilterSelect( | ||
todos, | ||
FilterOptions.Completed, | ||
onFilterSelect, | ||
setIsSelected, | ||
) |
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 piece of code is often repeated, however only one prop differs.
Also, 2 of the props are taken from the parent component as a prop, it means that it can be simplified. Do we need to expect todos and onFilterSelect in the function?
<button | ||
type="button" | ||
className={classNames('todoapp__toggle-all', { | ||
active: verifyActiveTodos(todos), |
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.
I would say we don't need a function for that since it is only used once
todos: Todo[]; | ||
}; | ||
|
||
export const Header: FC<Props> = ({ todos }) => { |
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.
we can return right away since there's no component logic inside
export const TodoList: FC<Props> = ({ todos }) => { | ||
return ( | ||
<section className="todoapp__main" data-cy="TodoList"> |
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 statement is not necessary here, we can return right away by wrapping component result in the round braces instead of the curly ones
DEMO LINK