title: How hide component from another component start render through route on react
body: <p>I would like to hide a component when another component is routing</p>
  
  <p>for more specific, i have a fixed bottom nav that i want to hide when a component is been route by user, in this case its a comment box</p>
  
  <p>My first option was trying on the parent component with browserhistory and history.listen, and componning a string with math.params for get a match between, and this change the state of parent, witch will hide the bottomnav, and the code wrote was trying through a cyclelife passing props, but nothing, anyone can help me please?</p>
  
  <pre><code>class App extends React.Component {
  
    constructor(props){
      super(props);
      this.state = {
        showBottomNav: true
      }
      this.hideBottomNav = this.hideBottomNav.bind(this)
    }
  
    hideBottomNav= () =&gt; {
      this.setState({
        showBottomNav: false
  
      })
    }
  
    render() {
  
      return (
        &lt;Router&gt;
          &lt;NavBar /&gt;
          &lt;Switch&gt;
            &lt;Route path='/' exact component={Home} /&gt;
            &lt;Route path='/wars' exact component={Tournament} /&gt;
            &lt;Route path='/shop' exact component={Shop} /&gt;
            &lt;Route path='/library' exact component={Library} /&gt;
            &lt;Route 
              path='/:id' 
              exact 
              render={ props =&gt; &lt;ExpandedPost {...props} parentMethod={() =&gt; this.hideBottomNav()} /&gt;} 
              /&gt;
          &lt;/Switch&gt;
          &lt;BottomNav /&gt;
        &lt;/Router&gt;
      );
    }
  }
  
  export default App;
  </code></pre>
  
  <p>And the children Component</p>
  
  <pre><code>export default function PostReview(props) {
  
      const classes = useStyles();
  
      useEffect(() =&gt; {
        props.parentMethod()
      },[props])
  
      return (
  
        &lt;div&gt;....
  
  
  
  </code></pre>