/home/techb158/cosmic-risk.abdallabala.com/src/components
Edit: /home/techb158/cosmic-risk.abdallabala.com/src/components/ErrorBoundary.jsx (951B)
'use client';
import { Component } from 'react';
export default class ErrorBoundary extends Component {
constructor(props) {
super(props);
this.state = { error: null };
}
static getDerivedStateFromError(error) {
return { error };
}
render() {
if (this.state.error) {
const { fallback } = this.props;
if (fallback) return typeof fallback === 'function' ? fallback(this.state.error) : fallback;
return (
!
Something went wrong in {this.props.name || 'this section'}.
{this.state.error.message}
);
}
return this.props.children;
}
}