fix: change build browserslist to fix BigInt native compatibiltiy

This commit is contained in:
MTG2000
2022-07-24 15:52:18 +03:00
parent ff9c13481f
commit 1eba3fed81
3 changed files with 50 additions and 10 deletions

View File

@@ -0,0 +1,35 @@
import React, { Component, ErrorInfo, ReactNode } from "react";
interface Props {
place?: string
children?: ReactNode;
}
interface State {
hasError: boolean;
}
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 at ${this.props.place}`, error, errorInfo);
}
public render() {
if (this.state.hasError) {
return <h1>Sorry.. there was an error</h1>;
}
return this.props.children;
}
}
export default ErrorBoundary;