diff --git a/src/ErrorBoundary.jsx b/src/ErrorBoundary.jsx new file mode 100644 index 00000000..202f4e85 --- /dev/null +++ b/src/ErrorBoundary.jsx @@ -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