import { Button, Result } from 'antd' import React, { ErrorInfo } from 'react' export class ErrorBoundary extends React.Component< Record, { hasError: boolean; errorInfo: string } > { static getDerivedStateFromError(error: Error) { return { hasError: true, errorInfo: error.message } } componentDidCatch(error: any, errorInfo: ErrorInfo) { // You can also log the error to an error reporting service // eslint-disable-next-line no-console console.log(error, errorInfo) } render() { if (this.state.hasError) { // You can render any custom fallback UI return (

{this.state.errorInfo}

} /> ) } return this.props.children } state = { hasError: false, errorInfo: '' } }