refactor(header): Move to consistent header component for modal elements

Co-authored-by: David Ralph <me@davidcralph.co.uk>
This commit is contained in:
alexsparkes
2024-02-10 10:45:21 +00:00
parent 84c1bc8df1
commit 6f00709c3d
13 changed files with 228 additions and 191 deletions

23
src/ErrorBoundary.jsx Normal file
View 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;