(Haraguroicha: 4) import React from 'react'; import PropTypes from 'prop-types'; import ServiceContext from '../services/context'; class PageErrorBoundary extends React.Component { constructor(props) { super(props); this.state = { hasError: false }; } componentDidCatch(error, info) { console.error(error, info); this.setState({ hasError: true, }); } render() { const { hasError } = this.state; if (hasError) { return Sorry, Something went wrong.; } const { children } = this.props; return children; } } PageErrorBoundary.propTypes = { children: PropTypes.node.isRequired, };