-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 #1051
base: master
Are you sure you want to change the base?
Develop #1051
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.
GJ 👍
Added a few small comments
src/App.tsx
Outdated
|
||
setTodos(todos); | ||
} catch (error) { | ||
console.error('Error loading todos:', error); |
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.
disable lint rule or handle error in different way
src/App.tsx
Outdated
useEffect(() => { | ||
const fetchTodos = async () => { | ||
try { | ||
const todos = await getTodos(); |
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 todos = await getTodos(); | |
const fetchedTodos = await getTodos(); |
to avoid lint error
src/App.tsx
Outdated
const searchQuery = useSelector((state: RootState) => state.filter.query); | ||
const status = useSelector((state: RootState) => state.filter.status); |
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 searchQuery = useSelector((state: RootState) => state.filter.query); | |
const status = useSelector((state: RootState) => state.filter.status); | |
const { searchQuery, status } = useSelector((state: RootState) => state.filter); |
src/App.tsx
Outdated
fetchTodos(); | ||
}, []); | ||
|
||
const filteredTodos = todos.filter(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.
use useMemo
return matchesQuery && matchesStatus; | ||
}); | ||
|
||
const handleTodoClick = (todo: 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.
redundant function wrapper, just use setSelectedTodo everywhere instead
reducers: {}, | ||
reducers: { | ||
setSearchQuery: (state, action) => { | ||
state.query = action.payload; |
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.
disable this rule for the entire file
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