{"size": 775, "ext": "js", "max_stars_repo_path": "client/src/components/App.js", "max_stars_repo_name": "kingsleyliao/node-react-boilerplate", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/src/components/App.js", "max_issues_repo_name": "kingsleyliao/node-react-boilerplate", "max_issues_repo_issues_event_min_datetime": "2020-07-27T23:51:07.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-27T23:51:07.000Z", "max_forks_repo_path": "client/src/components/App.js", "max_forks_repo_name": "kingsleyliao/node-react-boilerplate", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 25.0, "max_line_length": 66, "alphanum_fraction": 0.6077419355}
import React, { Component } from 'react';
import { Route, BrowserRouter, Switch } from 'react-router-dom';
import { connect } from 'react-redux';
import * as actions from '../actions';
import Header from './Header';
import Landing from './Landing';
import Home from './Home';
import { AuthRoute, ProtectedRoute } from '../utils/routeUtils';

class App extends Component {
  componentDidMount() {
    this.props.fetchUser();
  }

  render() {
    return (
      <BrowserRouter>
        <div>
          <Header />
          <Switch>
            <AuthRoute exact path="/" component={Landing} />
            <ProtectedRoute exact path="/home" component={Home} />
          </Switch>
        </div>
      </BrowserRouter>
    );
  }
}

export default connect(null, actions)(App);
