daniellesuper / elevationsoftware

0 stars 0 forks source link

Router should be separate from other components #2

Closed mattlisiv closed 4 years ago

mattlisiv commented 4 years ago

In App.js the Toolbar is mixed with the Router. In general, the router should not be mixed with other components related to UI. Relevant read about why .

One good way of reusing the the Toolbar and Footer without mixing in with the router is to create a single component (i.e. Layout) that wraps children and then you can re-use in each one of your pages, something like this :

return (
<>
  <Toolbar drawerClickHandler={this.drawerToggleClickHandler} />
  <SideDrawer show={this.state.sideDrawerOpen} />
  {backdrop}
  {this.props.children}
  <Footer />
<>
);

Child Props Example