UNPKG

@wordpress/block-editor

Version:
32 lines (30 loc) 636 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _element = require("@wordpress/element"); /** * WordPress dependencies */ class BlockCrashBoundary extends _element.Component { constructor() { super(...arguments); this.state = { hasError: false }; } componentDidCatch() { this.setState({ hasError: true }); } render() { if (this.state.hasError) { return this.props.fallback; } return this.props.children; } } var _default = exports.default = BlockCrashBoundary; //# sourceMappingURL=block-crash-boundary.js.map