diff --git a/src/components/Form.tsx b/src/components/Form.tsx index 232ce36e8..3ed170f56 100644 --- a/src/components/Form.tsx +++ b/src/components/Form.tsx @@ -1,23 +1,17 @@ -import React, { useContext, useEffect, useRef } from 'react'; +import React, { useEffect, useRef } from 'react'; import { useForm } from '../hooks/useForm'; -import { TodoContext } from '../store/TodoContext'; export const Form: React.FC = () => { const field = useRef(null); const { query, handleAddTodo, handleChangeQuery } = useForm(); - const { todos, isDeleted } = useContext(TodoContext); useEffect(() => { - if (!field.current) { - return; - } - - if (!todos.length || isDeleted) { + if (field.current) { field.current.focus(); } - }, [todos.length, isDeleted]); + }, []); return (