{"size": 874, "ext": "js", "max_stars_repo_path": "react-ui/src/App.js", "max_stars_repo_name": "millaalakuijala/ducksightings", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "react-ui/src/App.js", "max_issues_repo_name": "millaalakuijala/ducksightings", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "react-ui/src/App.js", "max_forks_repo_name": "millaalakuijala/ducksightings", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.0, "max_line_length": 49, "alphanum_fraction": 0.5354691076}
import React, { Component } from 'react'
import SightingList from './SightingList'
import Header from './Header'
import Navigation from './Navigation'
import AddSighting from './AddSighting'

class App extends Component {
  constructor(props) {
    super(props)
    this.state = {
      adding: false,
    }
  }

  changeView = () => {
    this.setState({ adding: !this.state.adding })
  }

  render() {
    if (this.state.adding) {
      return (
        <div>
          <Header />
          <Navigation
            adding={this.state.adding}
            changeView={this.changeView}
          />
          <AddSighting />
        </div>
      )
    }
    return (
      <div>
        <Header />
        <Navigation
          adding={this.state.adding}
          changeView={this.changeView}
        />
        <SightingList />
      </div>
    )
  }
}

export default App
