diff --git a/src/components/ErrorBoundary.tsx b/src/components/ErrorBoundary.tsx new file mode 100644 index 0000000..e13ebe5 --- /dev/null +++ b/src/components/ErrorBoundary.tsx @@ -0,0 +1,37 @@ +import * as React from 'react'; + +class ErrorBoundary extends React.Component { + state: { + error?: Error; + }; + + constructor(props: any) { + super(props); + this.state = { }; + } + + componentDidCatch(error: Error, info: any) { + this.setState({ error }); + } + + render() { + if (this.state.error) { + return ( +
+ {this.state.error.message} ++ +
+ {this.state.error.stack} ++