浏览代码

Lesson 02 Final

Ryan Florence 9 年之前
父节点
当前提交
9fc24d3601
共有 3 个文件被更改,包括 28 次插入1 次删除
  1. 12 1
      index.js
  2. 8 0
      modules/About.js
  3. 8 0
      modules/Repos.js

+ 12 - 1
index.js

@@ -1,4 +1,15 @@
 import React from 'react'
 import { render } from 'react-dom'
+import { Router, Route, hashHistory } from 'react-router'
 import App from './modules/App'
-render(<App/>, document.getElementById('app'))
+import About from './modules/About'
+import Repos from './modules/Repos'
+
+render((
+  <Router history={hashHistory}>
+    <Route path="/" component={App}/>
+    <Route path="/repos" component={Repos}/>
+    <Route path="/about" component={About}/>
+  </Router>
+), document.getElementById('app'))
+

+ 8 - 0
modules/About.js

@@ -0,0 +1,8 @@
+import React from 'react'
+
+export default React.createClass({
+  render() {
+    return <div>About</div>
+  }
+})
+

+ 8 - 0
modules/Repos.js

@@ -0,0 +1,8 @@
+import React from 'react'
+
+export default React.createClass({
+  render() {
+    return <div>Repos</div>
+  }
+})
+