text: import React, { Component } from 'react';
  import { object } from 'prop-types';
  
  class ErrorBoundary extends Component {
    constructor(props) {
      super(props);
      this.state = { hasError: false };
    }
    
    componentDidCatch() {
      this.setState({ hasError: true });
    }
    
    render() {
      if (this.state.hasError) {
        return <h1>Something went wrong.</h1>;
      }
      return this.props.children;
    }
  }
  
  ErrorBoundary.propTypes = {
    children: object
  }
  
  export default ErrorBoundary;
  