title: React: router with http header status
body: <p>I created my react app (client side rendering) as a single page app with react-router-dom. Catching the 404 pages is very simple using this:</p>
  
  <pre><code>import {Router} from 'react-router-dom';
  import {Switch, Route, Redirect} from 'react-router-dom';
  ...
  
  const Main = () =&gt; {
      return (
          &lt;Router history={history}&gt;
              &lt;Switch&gt;
                  &lt;Route exact path="/" component={Home}/&gt;
                  ...
                  &lt;Route path="*" status={404} component={PageNotFound}/&gt;
              &lt;/Switch&gt;
          &lt;/Router&gt;
      )
  };
  
  export default Main;
  </code></pre>
  
  <p>This works. But when the PageNotFound component is rendered, the <strong>http header status is still 200</strong>, not 404 as expected.</p>
  
  <p>Is there a way to set a 404 (or 301) page header when using client side rendering? </p>