BetterDiscordApp-v1/src/react/errorBoundary.js

17 lines
433 B
JavaScript

import BDV2 from "../v2";
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;
}
}