import React from 'react'; import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline'; export default class ErrorBoundary extends React.PureComponent { constructor(props) { super(props); this.state = { error: false }; this.language = window.language.modals.main.error_boundary; } static getDerivedStateFromError(error) { console.log(error); window.analytics.postEvent('modal', 'Error occurred'); return { error: true }; } render() { if (this.state.error) { return (

{this.language.title}

{this.language.message}

); } return this.props.children; } }