Skip to content

Instantly share code, notes, and snippets.

@ctrldavid
Created December 20, 2016 21:20
Show Gist options
  • Save ctrldavid/5dd93920763f8ac81ae6f7c92033bc45 to your computer and use it in GitHub Desktop.
Save ctrldavid/5dd93920763f8ac81ae6f7c92033bc45 to your computer and use it in GitHub Desktop.
// Router (doesn't include any info about headers):
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={LandingPageContainer} />
<Route path="home" component={LandingPageContainer} />
<Route path="authentication" component={Authentication} />
// ... others
</Route>
</Router>
// App (Doesn't interact with children at all)
export default function App({ children, location: { pathname } }) {
// This is the current 'hack', I'd like to just read in something from props that is passed down by the router
const hideHeader = pathname === '/' || pathname === '/home';
return <div className={css.app}>
<HeaderContainer overlay={hideHeader} />
{children}
<FooterContainer />
</div>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment