one
Version:
One is a new React Framework that makes Vite serve both native and web.
24 lines (23 loc) • 572 B
JavaScript
import React from "react";
class RootErrorBoundary extends React.Component {
state = { hasError: !1 };
static getDerivedStateFromError(error) {
return { hasError: !0 };
}
componentDidCatch(error, info) {
console.error(`RootErrorBoundary.error:
${printError(error)}
${info.componentStack}`);
}
render() {
return this.state.hasError ? null : this.props.children;
}
}
function printError(err) {
return `${err instanceof Error ? `${err.message}
${err.stack}` : err}`;
}
export {
RootErrorBoundary
};
//# sourceMappingURL=RootErrorBoundary.js.map