import { Component, type ReactNode } from "react"; import Navigation from "./Navigation"; import { Code, Container, Heading, Text } from "@chakra-ui/react"; interface ErrorState { error: string | null; errored: boolean; } type Props = { [k: string]: any; children: ReactNode; }; export default class Fallback extends Component { constructor(props: Props) { super(props); this.state = { error: null, errored: false }; } static getDerivedStateFromError(error: Error) { return { error, errored: true }; } render() { if (!this.state.errored) return this.props.children; return ( <> Oops! Something broke. See the details below
{this.state.error?.toString()}
{/* @ts-expect-error The stack property should always exist */} {this.state.error.stack} ); } }