Skip to content

Commit cc8780a

Browse files
authored
Merge pull request #33 from kmsheng/rr4
This patch upgrades react router version to 4.1.2
2 parents cf5a394 + 756d680 commit cc8780a

File tree

4 files changed

+1321
-1012
lines changed

4 files changed

+1321
-1012
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## 特色
66

77
* [react](https://github.com/facebook/react)
8-
* [react-router 3](https://github.com/rackt/react-router)
8+
* [react-router 4](https://reacttraining.com/react-router/web/example/basic)
99
* [webpack 2](https://github.com/webpack/webpack)
1010
* [babel stage-0 ](https://github.com/babel/babel)
1111
* [eslint](http://eslint.org)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"react": "^15.0.1",
3838
"react-dom": "^15.0.1",
3939
"react-hot-loader": "^3.0.0-beta.6",
40-
"react-router": "^3.0.2",
40+
"react-router-dom": "4.1.2",
4141
"sass-loader": "^6.0.6",
4242
"style-loader": "^0.13.1",
4343
"url-loader": "^0.5.7",

src/containers/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import React from 'react';
22
// import package
3-
import { Router, Route, hashHistory } from 'react-router';
3+
import { HashRouter as Router, Route, Switch } from 'react-router-dom';
44
import 'normalize.css/normalize.css';
55

66
// import relative path
77
import Home from './Home';
88
import NotFound from './NotFound';
99

10-
11-
// add router key to fix this issue
12-
// https://github.com/reactjs/react-router-redux/issues/179#issuecomment-275576250
1310
const Main = () => (
14-
<Router key={Math.random()} history={hashHistory}>
15-
<Route path="/" component={Home} />
16-
<Route path="*" component={NotFound} />
11+
<Router>
12+
<Switch>
13+
<Route exact path="/" component={Home} />
14+
<Route component={NotFound} />
15+
</Switch>
1716
</Router>
1817
);
1918

0 commit comments

Comments
 (0)