import React, { Component } from "react"; export class ErrorBoundary extends Component<{}, { error: any }> { constructor(props) { super(props); this.state = { error: null }; } static getDerivedStateFromError(error: any) { // Update state so the next render will show the fallback UI. return { error }; } componentDidCatch(error, errorInfo) { //console.error(error, errorInfo); } render() { if (this.state.error) { return (

Something went wrong.

{"" + this.state.error}

); } return this.props.children; } }