Skip to content

Commit

Permalink
fix:fix eslint erros
Browse files Browse the repository at this point in the history
  • Loading branch information
ab3MN committed Nov 15, 2024
1 parent e38039b commit 491c1d3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/hooks/useSelectedTodo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import { Todo } from '../types/Todo';
export const useSelectedTodo = () => {
const [selectedTodo, setSelectedTodo] = useState<Todo | null>(null);

const handleKeyPress = useCallback((event: KeyboardEvent) => {
if (event.key === 'Escape' && selectedTodo) {
setSelectedTodo(null);
}
}, []);
const handleKeyPress = useCallback(
(event: KeyboardEvent) => {
if (event.key === 'Escape' && selectedTodo) {
setSelectedTodo(null);
}
},
[setSelectedTodo],

Check warning on line 13 in src/hooks/useSelectedTodo.ts

View workflow job for this annotation

GitHub Actions / run_linter (20.x)

React Hook useCallback has a missing dependency: 'selectedTodo'. Either include it or remove the dependency array
);

useLayoutEffect(() => {
window.addEventListener('keydown', handleKeyPress);
Expand Down

0 comments on commit 491c1d3

Please sign in to comment.