title: React routeer is causing a blank index page. Next JS
body: <p>I'm creating a website, and I want the users to be directed to a specific page when they open the site. The page they are going to be directed to depends on if they already logged in. My problem is: the router doesn't work (<strong>user is not redirected to any page</strong>) and all that appears is a blank page. I've tried to get rid of the routes, but even though, I couldn't display anything on the index page. Maybe the problem is not even the router, but something else.</p>
  <p>I never get any error messages. Here are the parts of the code, where I think the problem may be.</p>
  <p>_app.js:</p>
  <pre><code>import React from 'react'
  import { BrowserRouter as Router, Route } from &quot;react-router-dom&quot;
  import Novidades from './lancamento'
  import SignUp from './signup'
  import Croosa from './croosa'
  import { AuthProvider } from '../utils/auth'
  import PrivateRoute from '../utils/PrivateRoute'
  
  
  const App = () =&gt; {
    return(
          &lt;AuthProvider&gt;
            &lt;Router&gt;
              &lt;div&gt;
                &lt;PrivateRoute exact path='/lancamento' component={Lancamento} /&gt;
                &lt;Route exact path='/croosa' component={Croosa}/&gt;
                &lt;Route exact path='/signup' component={SignUp} /&gt;
              &lt;/div&gt;
            &lt;/Router&gt;
          &lt;/AuthProvider&gt;
    )
  }
  
  export default App
  </code></pre>
  <p>index.js:</p>
  <pre><code>import React from 'react'
  import App from './_app'
  
  export default function Home() {
        return(
          &lt;App/&gt;
        )
  }
  </code></pre>
  <p>And the PrivateRoute.js, which decides to which page the user is going to be redirected:</p>
  <pre><code>import React, { useContext } from &quot;react&quot;;
  import { Route, Redirect } from &quot;react-router-dom&quot;;
  import { AuthContext } from &quot;./auth&quot;;
  
  const PrivateRoute = ({ component: RouteComponent, ...rest }) =&gt; {
    const {currentUser} = useContext(AuthContext);
    return (
      &lt;Route
        {...rest}
        render={routeProps =&gt;
          !!currentUser ? (
            &lt;RouteComponent {...routeProps} /&gt;
          ) : (
            &lt;Redirect to={&quot;/signup&quot;} /&gt;
          )
        }
      /&gt;
    )
  }
  
  
  export default PrivateRoute
  </code></pre>
  <p>I would appreciate it if someone could point out my mistake(s).</p>