-
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
Develop #1039
base: master
Are you sure you want to change the base?
Develop #1039
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.
your demo link doesn't work, try to fix that and then re-request the review
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/App.tsx
Outdated
const { todos, inputValue, filterStatus } = useContext(StateContext); | ||
const dispatch = useContext(DispatchContext); | ||
|
||
const inputElement = useRef<HTMLInputElement>(null); |
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 inputElement = useRef<HTMLInputElement>(null); | |
const inputElementRef = useRef<HTMLInputElement>(null); |
src/App.tsx
Outdated
const filteredTodos = todos.filter(todo => { | ||
const { completed } = todo; | ||
|
||
switch (filterStatus) { | ||
case Filter.Active: | ||
return !completed; | ||
|
||
case Filter.Completed: | ||
return completed; | ||
|
||
default: | ||
return 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.
move filter inside switch case not vice versa. To avoid redundant iteration in default case
DEMO LINK
Sorry, I accidentally made a pull request to the wrong branch, for some reason my pull request was made to the "develop" branch. I closed the wrong pull request