React Router 4 organizing routes

Viewed 1730

I'm currently trying to organize routes in my first React app using Router 4. The goal is to have some components opened (displayed) with the Navbar remaining on the page and some without the Navbar. I started with the idea of having all the components displayed under the NavBar container and it works just fine but now I need to add some links that open the linked components in the same window but without the Navbar. Maybe someone has an idea how to set such routing.

My current code:

 render() {

    return (
     <BrowserRouter>      
      <div className="App">   
        <div className="App-header">
        <h2>{this.state.title}</h2>
        <NavBar></NavBar>
        </div>
            <Switch>
              <Route exact path = "/" component = {Home} />
              <Route exact path = "/about" component = {About} />
              <Route exact path = "/register" component = {RegForm} />
            </Switch>    
       <footer className = "Footer"><Content /></footer>
       </div>
     </BrowserRouter>
    );

  }
1 Answers
Related