|
1 | 1 | import React from 'react' |
2 | | -import { NavLink as Link, Switch, Route } from 'react-router-dom' |
| 2 | +import { NavLink as Link, Switch, Route, Redirect } from 'react-router-dom' |
3 | 3 | import { Collapse, Navbar, NavbarToggler, NavbarBrand, Nav, NavLink, Container } from 'reactstrap' |
4 | 4 | import PropTypes from 'prop-types' |
5 | 5 | import './PageLayout.scss' |
6 | | -import Home from '../../routes/Home' |
7 | | -import Counter from '../../routes/Counter' |
| 6 | +import Home, { AsyncCounter, AsyncZen, AsyncElapse, AsyncRoute, AsyncPageNotFound } from '../../routes' |
8 | 7 |
|
9 | 8 | const location = { |
10 | 9 | pathname : '/route/8080', |
@@ -45,15 +44,20 @@ export default class PageLayout extends React.Component { |
45 | 44 | <NavLink to='/zen' activeClassName='active' tag={Link}>Zen</NavLink> |
46 | 45 | <NavLink to='/elapse' activeClassName='active' tag={Link}>Elapse</NavLink> |
47 | 46 | <NavLink to={location} activeClassName='active' tag={Link}>Route</NavLink> |
48 | | - <NavLink to='/notFound' activeClassName='active' tag={Link}>404</NavLink> |
| 47 | + <NavLink to='/pageNotFound' activeClassName='active' tag={Link}>404</NavLink> |
49 | 48 | <NavLink href='https://github.com/YutHelloWorld/vortex-react'>Github</NavLink> |
50 | 49 | </Nav> |
51 | 50 | </Collapse> |
52 | 51 | </Navbar> |
53 | 52 | <Container className='text-center page-layout__viewport'> |
54 | 53 | <Switch> |
55 | 54 | <Route exact path='/' component={Home} /> |
56 | | - <Route path='/counter' component={Counter} /> |
| 55 | + <Route path='/counter' component={AsyncCounter} /> |
| 56 | + <Route path='/zen' component={AsyncZen} /> |
| 57 | + <Route path='/elapse' component={AsyncElapse} /> |
| 58 | + <Route path='/route/:id' component={AsyncRoute} /> |
| 59 | + <Route path='/404' component={AsyncPageNotFound} /> |
| 60 | + <Redirect from='*' to='/404' /> |
57 | 61 | </Switch> |
58 | 62 | </Container> |
59 | 63 | </div> |
|
0 commit comments