Skip to content

Instantly share code, notes, and snippets.

@MacgyverMartins
Last active August 9, 2018 15:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MacgyverMartins/842282e916dd25553ecb32c488bdce37 to your computer and use it in GitHub Desktop.
Save MacgyverMartins/842282e916dd25553ecb32c488bdce37 to your computer and use it in GitHub Desktop.
PrimaryLayout example
import React from 'react'
import { Switch, Route, Redirect } from 'react-router-dom'
import Header from '../componets/Header'
import HomePage from '../pages/HomePage'
import UsersPage from '../pages/UsersPage'
import ProductsPage from '../pages/ProductsPage'
const PrimaryLayout = ({ match }) => (
<div className="primary-layout">
<Header />
<main>
<Switch>
<Route path={`${match.path}`} exact component={HomePage} />
<Route path={`${match.path}/users`} component={UsersPage} />
<Route path={`${match.path}/products`} component={ProductsPage} />
<Redirect to={`${match.url}`} />
</Switch>
</main>
</div>
)
export default PrimaryLayout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment