BetterDiscordApp-rauenzi/src/ui/errorBoundary.js

17 lines
441 B
JavaScript
Raw Normal View History

2020-03-25 05:19:02 +01:00
import BDV2 from "../modules/v2";
2020-03-24 04:21:22 +01:00
export default class BDErrorBoundary extends BDV2.reactComponent {
constructor(props) {
super(props);
this.state = {hasError: false};
}
componentDidCatch() {
this.setState({hasError: true});
}
render() {
if (this.state.hasError) return BDV2.react.createElement("div", {className: "react-error"}, "Component Error");
return this.props.children;
}
}