-
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
task solution #785
base: master
Are you sure you want to change the base?
task solution #785
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
src/App.tsx
Outdated
</button> | ||
</footer> | ||
<TodoApp /> | ||
{todos.length !== 0 && <TodosFilter />} |
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 && <TodosFilter />} | |
{!!todos.length && <TodosFilter />} |
src/components/TodosFilter.tsx
Outdated
const { todos, status, dispatch } = useContext(TodosContext); | ||
const [showButton, setShowButton] = useState(false); | ||
|
||
const uncompletedTodos = todos.filter(todo => todo.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.
const uncompletedTodos = todos.filter(todo => todo.completed === false); | |
const uncompletedTodos = todos.filter(todo => !todo.completed); |
type="checkbox" | ||
className="toggle" | ||
checked={item.completed} | ||
onChange={() => dispatch({ type: 'TOGGLE_TODO', payload: item })} |
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.
Consider will be better if you move this logic from the jsx to the helper function 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.
Well done!
DEMO LINK