import {Component,type ErrorInfo,type ReactNode} from 'react'; import {Button} from '../components/ui'; export class ErrorBoundary extends Component<{children:ReactNode},{error?:Error}>{state:{error?:Error}={};static getDerivedStateFromError(error:Error){return {error};}componentDidCatch(error:Error,info:ErrorInfo){console.error('React fatal error',error,info);}render(){return this.state.error?

界面发生致命错误

{this.state.error.message}
:this.props.children;}}