diff --git a/src/components/ErrorNotification/ErrorNotification.tsx b/src/components/ErrorNotification/ErrorNotification.tsx index 0fd6eff53..2ff1c5874 100644 --- a/src/components/ErrorNotification/ErrorNotification.tsx +++ b/src/components/ErrorNotification/ErrorNotification.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react'; +import { FC, useEffect } from 'react'; import { ErrorMessages } from '../../types/ErrorMessages'; import cn from 'classnames'; @@ -11,6 +11,14 @@ export const ErrorNotification: FC = ({ errorMessage, onResetError, }) => { + useEffect(() => { + const timerId = setTimeout(() => { + onResetError(); + }, 3000); + + return () => clearTimeout(timerId); + }, [errorMessage]); + return (
= ({ return (
- {todos.length > 0 &&