title: React router not open 404 not found page
body: <p>I created following with react router.</p>
  
  <pre><code>import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; 
  
  class Main extends Component {
  
  render() {   
          return ( 
      &lt;Router&gt;
       &lt;Switch&gt;
         &lt;Route exact path='/' component={Content} /&gt;   
         &lt;Route path='/user/:id' component={User} /&gt; 
         &lt;Route path='*' component={NotFound} /&gt;
       &lt;/Switch&gt;  
      &lt;/Router&gt;
      );
  }
  
  export default Main
  </code></pre>
  
  <p>I want to open Notfound page if any invalid url.</p>
  
  <p>I tried to open <code>localhost:3000/err</code> but, it will not go to NotFound compoenent.</p>
  
  <p>My notfound component is simple.</p>
  
  <pre><code>import React from 'react';
  
  const NotFound = () =&gt; (
      &lt;h2&gt;404 Page Not Found&lt;/h2&gt;
  );
  
  export default NotFound;
  </code></pre>
  
  <p>I am using <code>"react-router-dom": "^4.3.1</code></p>