UNPKG

@trap_stevo/legendarybuilderproreact-ui

Version:

The legendary UI & utility API that makes your application a legendary application. ~ Created by Steven Compton

43 lines 1.75 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/inherits"; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } import React, { Component } from "react"; var HUDErrorShield = /*#__PURE__*/function (_Component) { _inherits(HUDErrorShield, _Component); function HUDErrorShield(props) { var _this; _classCallCheck(this, HUDErrorShield); _this = _callSuper(this, HUDErrorShield, [props]); _this.state = { hasError: false }; return _this; } _createClass(HUDErrorShield, [{ key: "componentDidCatch", value: function componentDidCatch(error, errorInfo) { console.error("Deflected error from application: ", error, errorInfo); } }, { key: "render", value: function render() { if (this.state.hasError) { return null; } return this.props.children; } }], [{ key: "getDerivedStateFromError", value: function getDerivedStateFromError(error) { return { hasError: true }; } }]); return HUDErrorShield; }(Component); export default HUDErrorShield;