title: How do I detect when router path '/' is true?
body: <p>How do I detect when the '/' root path is true? I want to set up some basic code to hide the Navbar element when on the path '/' but everything I've seen requires use of hooks and my application is set up inside of a class component so I can't use these hooks any solutions? basic code so far.</p>
  
  <pre><code>import React, { Component, Fragment } from 'react'
  import { BrowserRouter, Route, Switch } from 'react-router-dom'
  import './tailwind.css'
  import { LandingPage } from './components/LandingPage'
  import { PortsmouthMap } from './components/Map'
  import { Timeline } from './components/04-components/timeline/Timeline'
  import Error from './components/Error'
  import { HomeLoading } from '../src/components/01-global/homepageLoading'
  import Nav from './components/Navigation/Nav';
  import SideDrawer from './components/Navigation/SideDrawer';
  
  
  export class App extends Component {
    constructor(props) {
      super(props)
      this.state = {
        nav: false
      }
  
    NoNav = () =&gt; {
      this.setState({ nav: false });
    }
  
    ShowNav = () =&gt; {
      this.setState({ nav: true });
      console.log('nav')
    }
  
  render() {
  
      return (
        &lt;Fragment&gt;
  
          &lt;BrowserRouter&gt;
            &lt;HomeLoading state={this.state} /&gt;
            {this.state.nav &amp;&amp; &lt;Nav
              sideDrawerOpen={this.state.sideDrawerOpen}
              drawerClickHandler={this.drawerToggleClickHandler} /&gt;}
            &lt;SideDrawer sidedrawerClickHandler={this.sidedrawerToggleClickHandler} show={this.state.sideDrawerOpen} /&gt;
            &lt;div onClick={this.backdropClickHandler} className="h-full w-full" style={{ ...this.state.sideDrawerOpen === false ? sideMenuInactive : sideMenuActive }}&gt;
              &lt;Switch&gt;
                &lt;Route path="/" render={() =&gt; &lt;LandingPage appOnLoad={this.appOnLoad} isAuthed={true} /&gt;} exact /&gt;
                &lt;Route path="/Map" render={() =&gt; &lt;PortsmouthMap appOnLoad={this.appOnLoad} isAuthed={true} /&gt;} /&gt;
                &lt;Route path="/Timeline" render={() =&gt; &lt;Timeline appOnLoad={this.appOnLoad} isAuthed={true} /&gt;} /&gt;
                &lt;Route component={Error} /&gt;
              &lt;/Switch&gt;
            &lt;/div&gt;
          &lt;/BrowserRouter&gt;
        &lt;/Fragment&gt;
      );
    }
  }
  </code></pre>