UNPKG

@urban-bot/core

Version:

The universal chatbot library based on React

22 lines 611 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrorBoundary = void 0; const react_1 = require("react"); class ErrorBoundary extends react_1.Component { constructor(props) { super(props); this.state = { hasError: false }; } static getDerivedStateFromError(error) { console.error(error); return { hasError: true }; } render() { if (this.state.hasError) { return null; } return this.props.children; } } exports.ErrorBoundary = ErrorBoundary; //# sourceMappingURL=ErrorBoundary.js.map