{"size": 800, "ext": "js", "max_stars_repo_path": "src/App.js", "max_stars_repo_name": "Tejasvp25/frontend", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/App.js", "max_issues_repo_name": "Tejasvp25/frontend", "max_issues_repo_issues_event_min_datetime": "2021-04-29T08:19:30.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-08T16:23:39.000Z", "max_forks_repo_path": "src/App.js", "max_forks_repo_name": "Yet-Another-Paste-Bin/frontend", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 20.0, "max_line_length": 69, "alphanum_fraction": 0.6225}
import React, { Suspense, Component } from "react";
import "./App.css";
import Loading from "./components/Loading";

class ErrorBoundary extends Component {
  constructor(props) {
    super(props);
    this.state = { hasError: false };
  }

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

  componentDidCatch(error, errorInfo) {
    console.log(error, errorInfo);
  }

  render() {
    if (this.state.hasError) return <h1>Something went wrong:( </h1>;
    return this.props.children;
  }
}

const BaseApp = React.lazy(() => import("./BaseApp"));

function App() {
  return (
    <div className="App">
      <ErrorBoundary>
        <Suspense fallback={<Loading />}>
          <BaseApp />
        </Suspense>
      </ErrorBoundary>
    </div>
  );
}

export default App;
