UNPKG

@atlaskit/dynamic-table

Version:

A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.

39 lines 1.72 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 from 'react'; // eslint-disable-next-line @repo/internal/react/no-class-components export var ErrorBoundary = /*#__PURE__*/function (_React$Component) { function ErrorBoundary(props) { var _this; _classCallCheck(this, ErrorBoundary); _this = _callSuper(this, ErrorBoundary, [props]); _this.state = { hasError: false }; return _this; } _inherits(ErrorBoundary, _React$Component); return _createClass(ErrorBoundary, [{ key: "render", value: function render() { if (this.state.hasError) { // You can render any custom fallback UI return this.props.fallback; } return this.props.children; } }], [{ key: "getDerivedStateFromError", value: function getDerivedStateFromError() { // Update state so the next render will show the fallback UI. return { hasError: true }; } }]); }(React.Component);