Sha256: 07395439ee2710a632d66249846b73c3f58b662b6426ae5499849701646dbc36
Contents?: true
Size: 876 Bytes
Versions: 3
Compression:
Stored size: 876 Bytes
Contents
/** @jsx jsx */ import { jsx, css } from '@emotion/react' import React, { Component, ErrorInfo, ReactNode } from "react"; interface Props { children: ReactNode; } interface State { hasError: boolean; } // https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/error_boundaries/ class ErrorBoundary extends Component<Props, State> { public state: State = { hasError: false }; public static getDerivedStateFromError(_: Error): State { // Update state so the next render will show the fallback UI. return { hasError: true }; } public componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error("Uncaught error:", error, errorInfo); } public render() { if (this.state.hasError) { return <h1>Sorry..there was an error</h1>; } return this.props.children; } } export default ErrorBoundary;
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
procon_bypass_man-web-0.1.3 | src/lib/error_boundary.tsx |
procon_bypass_man-web-0.1.2 | src/lib/error_boundary.tsx |
procon_bypass_man-web-0.1.1 | src/lib/error_boundary.tsx |