{"size": 826, "ext": "js", "max_stars_repo_path": "frontend/src/components/Home.js", "max_stars_repo_name": "nokia-wroclaw/innovativeproject-chatbot", "max_stars_repo_stars_event_min_datetime": "2019-03-08T12:05:45.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-13T09:10:22.000Z", "max_issues_repo_path": "frontend/src/components/Home.js", "max_issues_repo_name": "vegetablecode/ZIwG-chatbot", "max_issues_repo_issues_event_min_datetime": "2020-05-25T09:09:39.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T03:10:52.000Z", "max_forks_repo_path": "frontend/src/components/Home.js", "max_forks_repo_name": "vegetablecode/ZIwG-chatbot", "max_forks_repo_forks_event_min_datetime": "2019-03-08T12:15:59.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-01T20:00:24.000Z"}
{"max_stars_count": 5, "max_issues_count": 8, "max_forks_count": 3, "avg_line_length": 22.3243243243, "max_line_length": 74, "alphanum_fraction": 0.5217917676}
import React, { Component } from "react";
import axios from "axios";
import { baseUrl } from "../config";

class Home extends Component {
  state = {
    hello: ""
  };

  componentDidMount() {
    console.log(baseUrl + `/api/test/`);
    axios.get(baseUrl + `/api/test/`).then(res => {
      const response = res.data;
      this.setState({ hello: response.hello });
    });
  }

  render() {
    const name = this.state.hello ? this.state.hello : "no connection :(";
    return (
      <div className="container">
        <div className="center">
          <div className="col s12 m7">
            <div className="card">
              <div className="card-content">
                <h1>Hello {name}</h1>
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  }
}

export default Home;
