title: TypeError: Cannot read property 'location' of undefined in react
body: <p>I am creating a simple React application, and while implementing Routing I get following error:</p>
  
  <p>TypeError: Cannot read property 'location' of undefined in react.</p>
  
  <p>App.js:</p>
  
  <pre><code>import React, { Component } from 'react';
  import logo from './logo.svg';
  import './App.css';
  import Header from "./components/header";
  import Home from "./components/Home";
  import About from "./components/About";
  import Contact from "./components/Contact";
  import { Router, Route} from 'react-router'
  
  class App extends Component {
    render() {
      return (
        &lt;div className="App"&gt;
        &lt;Header /&gt;
  
     &lt;Router&gt;
        &lt;Route path = "/" component = {App}&gt;
           &lt;Route path = "home" component = {Home} /&gt;
           &lt;Route path = "about" component = {About} /&gt;
           &lt;Route path = "contact" component = {Contact} /&gt;
        &lt;/Route&gt;
     &lt;/Router&gt;
          &lt;header className="App-header"&gt;
            &lt;img src={logo} className="App-logo" alt="logo" /&gt;
            &lt;p&gt;
  
              Edit &lt;code&gt;src/App.js&lt;/code&gt; and save to reload.
            &lt;/p&gt;
            &lt;a  className="App-link"  href="https://reactjs.org"target="_blank"  rel="noopener noreferrer"&gt;
              Learn React
            &lt;/a&gt;
          &lt;/header&gt;
        &lt;/div&gt;
      );
    }
  }
  
  export default App;
  </code></pre>
  
  <p>What am I missing here?</p>