import { useEffect, useState } from 'react'; import { useErrorHandler } from '../../hooks/useErrorHandler'; export default function GlobalErrorDisplay() { const { errors, clearError, clearAllErrors } = useErrorHandler('GlobalErrorDisplay'); const [isVisible, setIsVisible] = useState(false); useEffect(() => { setIsVisible(errors.length > 0); }, [errors.length]); if (!isVisible || errors.length === 0) { return null; } return (
{error.message}
{error.stack && (
{error.stack}