From d3c7705bedebd65c94f9eea691aaf2fe03b0cafe Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 19 Aug 2023 13:58:45 -0700 Subject: Move to Vite --- modern/src/ErrorBoundary.jsx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 modern/src/ErrorBoundary.jsx (limited to 'modern/src/ErrorBoundary.jsx') diff --git a/modern/src/ErrorBoundary.jsx b/modern/src/ErrorBoundary.jsx new file mode 100644 index 00000000..93a6fe0f --- /dev/null +++ b/modern/src/ErrorBoundary.jsx @@ -0,0 +1,35 @@ +import React from 'react'; +import { Alert } from '@mui/material'; + +class ErrorBoundary extends React.Component { + constructor(props) { + super(props); + this.state = { + error: null, + }; + } + + static getDerivedStateFromError(error) { + return { error }; + } + + /* eslint-disable react/no-danger */ + render() { + const { error } = this.state; + if (error) { + return ( + + ').replaceAll(' ', ' '), + }} + /> + + ); + } + const { children } = this.props; + return children; + } +} + +export default ErrorBoundary; -- cgit v1.2.3