Last active
April 17, 2019 21:36
-
-
Save CesarDenis/1dd082be1df0549b36e794beead62145 to your computer and use it in GitHub Desktop.
React Router
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 { Route, Redirect, Switch } from 'react-router-dom'; | |
import Header from '~/components/Header'; | |
import Dashboard from '~/pages/Dashboard'; | |
import Users from '~/pages/Users'; | |
const Main = () => ( | |
<div id="app-container"> | |
<Header /> | |
<main> | |
<Switch> | |
<Route path="/dasboard" component={Dashboard} /> | |
<Route path="/users" component={Users} /> | |
<Redirect from="/" to="/dasboard" /> | |
</Switch> | |
</main> | |
</div> | |
); | |
export default Main; |
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 } from 'react-router-dom'; | |
import Private from './private'; | |
import Guest from './guest'; | |
import Main from '~/pages/Main'; | |
import SignUp from '~/pages/Auth/SignUp'; | |
import SignIn from '~/pages/Auth/SignIn'; | |
const Routes = () => ( | |
<Switch> | |
<Guest path="/signin" component={SignIn} /> | |
<Guest path="/signup" component={SignUp} /> | |
<Private path="/" exact component={Main} /> | |
</Switch> | |
); | |
export default Routes; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment