import { Component, PropsWithChildren } from "react"; import UIError from "@/pages/errors/UIError"; interface State { error: Error | null; } class ErrorBoundary extends Component { constructor(props: object) { super(props); this.state = { error: null }; } componentDidCatch(error: Error) { this.setState({ error }); } render() { const { children } = this.props; const { error } = this.state; if (error) { return ; } return children; } } export default ErrorBoundary;