-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRoot.js
26 lines (19 loc) · 1016 Bytes
/
Root.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import React, { lazy } from 'react';
import { BrowserRouter, Route, Switch, Redirect } from "react-router-dom";
/***** Components *****/
import { Layout, SideMenu } from './components';
/***** Pages *****/
const HomePage = lazy(() => import('./pages/HomePage/HomePage.js'));
const AboutPage = lazy(() => import('./pages/AboutPage/AboutPage.js'));
/*** Utils pages ***/
const ErrorPage = lazy(() => import('./pages/UtilPages/ErrorPage.js'));
const Root = () =>
<BrowserRouter basename="/">
<Switch>
<Redirect exact from='/' to='/home'/>
<Route exact path='/home' render={props => <Layout main={<HomePage/>} pageName="Home" menu={<SideMenu active="home"/>} {...props}/>}/>
<Route exact path='/about' render={props => <Layout main={<AboutPage/>} pageName="About" menu={<SideMenu active="about"/>} {...props}/>}/>
<Route render={props => <Layout main={<ErrorPage code={404}/>} {...props}/>}/>
</Switch>
</BrowserRouter>
export default Root;