Skip to content

Instantly share code, notes, and snippets.

@tapandave08
Created November 17, 2017 07:56
Show Gist options
  • Save tapandave08/112c1dc71171ba0167733180eaff7c99 to your computer and use it in GitHub Desktop.
Save tapandave08/112c1dc71171ba0167733180eaff7c99 to your computer and use it in GitHub Desktop.
import React, { Component } from "react";
import "./App.css";
import { Route, Switch, Router } from "react-router-dom";
import Header from "../src/components/header/header";
import SideBar from "../src/components/sidebar/sidebar";
import Login from "./components/login/login.js";
import Dashboard from "./components/dashboard/dashboard";
import RequireAuth from "./components/utility/require-auth";
import history from "./components/utility/history";
import Profile from "./components/user/profile";
class App extends Component {
render() {
return (
<Router history={history}>
<Switch>
<Route path="/" exact component={Login} />
<Route path="/layout" exact component={Container} />
{/* <Route path="/profile" exact component={RequireAuth(Profile)} /> */}
</Switch>
</Router>
);
}
}
const Container = ({ match }) => (
<div>
<Header />
<div className="main">
<SideBar />
<Route
path={`${match.path}/dashboard`}
component={RequireAuth(Dashboard)}
/>
</div>
</div>
);
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment