title: React: Uncaught TypeError: Cannot read property 'exact' of undefined
body: <p>So I've built a react app and it works fine using <code>npm start</code>, so now I am trying to deploy it to a server.</p>
  
  <p>I am trying to use Nginx to deploy the app, but after building it I suddenly get an error which doesn't happen when using <code>npm start</code>.</p>
  
  <p>So I configured Nginx, built the app using <code>npm run build</code>, but now when I visit the index through my servers IP I get the following </p>
  
  <pre><code>error:
  Uncaught TypeError: Cannot read property 'exact' of undefined
      at Object.&lt;anonymous&gt; (react-router-dom.js:288)
      at f ((index):1)
      at Module.951 (Home.js:14)
      at f ((index):1)
      at Object.434 (profile.svg:1)
      at f ((index):1)
      at a ((index):1)
      at Array.e [as push] ((index):1)
      at main.22a79b93.chunk.js:1
  </code></pre>
  
  <p>It appears to be something with my react router, which is as follows:</p>
  
  <pre><code>import {Redirect, BrowserRouter as Router,Route,Switch} from 'react-router-dom';
  
  &lt;Router&gt;
        &lt;CookieConsent buttonText="Accept"&gt;
  
        &lt;/CookieConsent&gt;
  
        &lt;Switch&gt;
          &lt;Route exact path="/" component={Home} /&gt;
          &lt;Route path="/Register" component={Register} /&gt;
          &lt;Route path="/Account" component={Account}/&gt;
          &lt;Route path="/logout" component={Logout}/&gt;
        &lt;/Switch&gt;
  
        &lt;Route
          path="/dashboard"
          render={({ match: { url } }) =&gt; (
            &lt;Authenticator&gt;
                    &lt;Dashboard&gt;
                      &lt;Switch&gt;
                        &lt;Route path={`${url}/Account`} component={Account} exact /&gt;
                        &lt;Route path={`${url}/Profile`} component={Profile} exact /&gt;
                        &lt;Route path={`${url}/`} component={Account} exact /&gt;
                        &lt;Route component={Page404Dashboard} /&gt;
                      &lt;/Switch&gt;
                    &lt;/Dashboard&gt;
          &lt;/Authenticator&gt;
          )}/&gt;
  
    &lt;/Router&gt;
  </code></pre>
  
  <p>But I cannot find anything here.</p>
  
  <p>What am I missing?</p>