one
Version:
One is a new React Framework that makes Vite serve both native and web.
26 lines (25 loc) • 587 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.mjs.map