| 1 | 'use client'; |
| 2 | |
| 3 | import * as React from 'react'; |
| 4 | |
| 5 | export default class ErrorBoundary extends React.Component { |
| 6 | state = {error: null}; |
| 7 | static getDerivedStateFromError(error) { |
| 8 | return {error}; |
| 9 | } |
| 10 | render() { |
| 11 | if (this.state.error) { |
| 12 | return React.createElement( |
| 13 | 'div', |
| 14 | {}, |
| 15 | 'Caught an error: ' + this.state.error.message |
| 16 | ); |
| 17 | } |
| 18 | return this.props.children; |
| 19 | } |
| 20 | } |