import React from "react";

export default class ErrorBoundary extends React.Component {
  state = { hasError: false };

  static getDerivedStateFromError() {
    return { hasError: true };
  }

  render() {
    if (this.state.hasError) {
      return <h3>Es gab einen Fehler im Frontend.</h3>;
    }

    return this.props.children;
  }
}
