import React, { ClassicComponent, ErrorInfo } from "react"; import Modal from "../portals/modal"; export class ErrorBoundary extends React.Component { constructor(props: any) { super(props); } state = { currentError: null, errorInfo: null, }; componentDidCatch(error: Error, info: ErrorInfo) { this.setState({ currentError: error, errorInfo: info, }); } render() { return ( <> {this.props.children} {this.state.currentError && ( this.setState({ currentError: null, errorInfo: null }) } >

{this.state.errorInfo}

)} ); } } export default ErrorBoundary;