title: Routing in child component using react-router-dom
body: <p>I’m using the CoreUI Pro template for a React dashboard, and trying to integrate logging in functionality into it. My log in is using AWS Cognito, so I’m using <a href="https://serverless-stack.com" rel="nofollow noreferrer">this</a> tutorial for that part.</p>
  
  <p>The problem I have is that once logged in, the links don’t work.</p>
  
  <p>My top level routes.js is below. </p>
  
  <pre><code>export default ({ childProps }) =&gt;
    &lt;HashRouter&gt;
      &lt;Switch&gt;
        &lt;AppliedRoute path='/' exact component={Login} props={childProps} /&gt;
        &lt;UnauthenticatedRoute path='/login' exact component={Login} props={childProps} /&gt;
        &lt;AuthenticatedRoute path='/dashboard' exact component={Full} props={childProps} /&gt;
        &lt;Route component={NotFound} /&gt;
      &lt;/Switch&gt;
    &lt;/HashRouter&gt;
  </code></pre>
  
  <p>In the Login component, I redirect to /dashboard and that works ok. Full is the name of the component which contains the dashboard.</p>
  
  <p>Once the user is in the Full component, then I want them to be able to navigate around:</p>
  
  <pre><code>&lt;Container fluid&gt;
                &lt;Switch&gt;
                  &lt;Route path='/dashboard' name='Dashboard' component={Dashboard} /&gt;
                  &lt;Route path='/deliveries/listDeliveries' name='List Deliveries' component={ListDeliveries} /&gt;
                  &lt;Route path='/shifts/listShifts' name='List Shifts' component={ListShifts} /&gt;
                  &lt;Route path='/locations/' name='Locations' component={Locations} /&gt;
                  &lt;Redirect from='/' to='/dashboard' /&gt;
                &lt;/Switch&gt;
              &lt;/Container&gt;
  </code></pre>
  
  <p>In the CoreUI template this works, but for me if I navigate to /locations after logging in, it goes to my 404 page. I thought about moving everything to the routes.js, but the problem there is that Full has a surrounding template for the page, it's just loading the components like Locations in one area of the page. </p>