-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
53 lines (47 loc) · 1.02 KB
/
main.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
let {Router, Route, Link, browserHistory} = window.ReactRouter;
class Index extends React.Component {
render() {
return (
<div>
<h1>Hello React!</h1>
<ul>
<li><Link to='/ghtest/about'>About</Link></li>
<li><Link to='/ghtest/article'>Article</Link></li>
<li><Link to='/ghtest/foo/barr'>deeeep</Link></li>
</ul>
{this.props.children}
</div>
);
}
}
class About extends React.Component {
render() {
return (
<div>About</div>
);
}
}
class Article extends React.Component {
render() {
return (
<div>Article</div>
);
}
}
class Deep extends React.Component {
render() {
return (
<div>Deep</div>
);
}
}
ReactDOM.render((
<Router history={browserHistory}>
<Route path='/ghtest' component={Index}>
<Route path='about' component={About}/>
<Route path='article' component={Article}/>
<Route path='foo/barr' component={Deep}/>
</Route>
</Router>
), document.getElementById('content')
);