forked from ruanyf/webpack-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
68 lines (61 loc) · 1.38 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react';
import { render } from 'react-dom';
import { Router, Route, Link, IndexRoute } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
require('./app.css');
var App = React.createClass({
render: function () {
return (
<div>
<header>
<ul>
<li><Link to="/app">Dashboard</Link></li>
<li><Link to="/inbox">Inbox</Link></li>
<li><Link to="/calendar">Calendar</Link></li>
</ul>
Logged in as Jane
</header>
{this.props.children}
</div>
);
}
});
var Dashboard = React.createClass({
render: function () {
return (
<div>
<p>Dashboard</p>
</div>
);
}
});
var Inbox = React.createClass({
render: function () {
return (
<div>
<p>Inbox</p>
</div>
);
}
});
var Calendar = React.createClass({
render: function () {
return (
<div>
<p>Calendar</p>
</div>
);
}
});
let history = createBrowserHistory();
render((
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Dashboard}/>
<Route path="app" component={Dashboard}/>
<Route path="inbox" component={Inbox}/>
<Route path="calendar" component={Calendar}/>
<Route path="*" component={Dashboard}/>
</Route>
</Router>
), document.body);