mirror of
https://github.com/mue/mue.git
synced 2026-07-22 08:17:28 +02:00
refactor(header): Move to consistent header component for modal elements
Co-authored-by: David Ralph <me@davidcralph.co.uk>
This commit is contained in:
23
src/ErrorBoundary.jsx
Normal file
23
src/ErrorBoundary.jsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
class ErrorBoundary extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = { hasError: false };
|
||||
}
|
||||
|
||||
componentDidCatch(error, errorInfo) {
|
||||
this.setState({ hasError: true });
|
||||
console.error('Error boundary caught an error:', error, errorInfo);
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) {
|
||||
return <div>Mue has broken horribly</div>;
|
||||
}
|
||||
|
||||
return this.props.children;
|
||||
}
|
||||
}
|
||||
|
||||
export default ErrorBoundary;
|
||||
Reference in New Issue
Block a user