-
Notifications
You must be signed in to change notification settings - Fork 0
/
Routes.jsx
47 lines (40 loc) · 1.33 KB
/
Routes.jsx
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import React from "react"
import PropTypes from "prop-types"
import {Router, Route, Switch} from "react-router-dom"
import * as Components from "../components"
export default () =>
<Components.App>
<Components.ContentPage>
<Switch>
<Route exact path='/' component={Components.Home} />
<Route path="/active" component={Components.Home} />
<Route path="/completed" component={Components.Home} />
<Route path="*" component={Components.NotFound} />
</Switch>
</Components.ContentPage>
</Components.App>
// StaticRouter extracted from:
// https://github.com/ReactTraining/react-router/blob/master/packages/react-router/modules/StaticRouter.js
// and
// https://gist.github.com/tomatau/9c6011dcb5b9f357368aac2b3a2b1430
// It is used to separate static history and StaticRouter to be used with "react-router-redux"
// during server rendering. Remove it when "react-router" is updated.
export class StaticRouter extends React.Component {
static propTypes = {
history: PropTypes.object,
};
static childContextTypes = {
router: PropTypes.object.isRequired,
}
getChildContext() {
return {
router: {
staticContext: this.props.history.context,
},
}
}
render() {
const {history, ...props} = this.props
return <Router {...props} history={history} />
}
}