Last active
August 9, 2018 15:40
-
-
Save MacgyverMartins/842282e916dd25553ecb32c488bdce37 to your computer and use it in GitHub Desktop.
PrimaryLayout example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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