Skip to content

Commit c112e14

Browse files
committed
2 parents d002c2b + cc8780a commit c112e14

File tree

4 files changed

+1649
-1074
lines changed

4 files changed

+1649
-1074
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
"less": "^2.7.1",
3131
"less-loader": "^2.2.3",
3232
"node-sass": "^4.5.3",
33+
"normalize.css": "^7.0.0",
3334
"null-loader": "^0.1.1",
3435
"postcss": "^5.0.21",
3536
"postcss-loader": "^1.3.3",
3637
"react": "^15.0.1",
3738
"react-dom": "^15.0.1",
3839
"react-hot-loader": "^3.0.0-beta.6",
39-
"react-router": "^3.0.2",
40+
"react-router-dom": "4.1.2",
4041
"sass-loader": "^6.0.6",
4142
"style-loader": "^0.13.1",
4243
"url-loader": "^0.5.7",

src/containers/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +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';
4+
import 'normalize.css/normalize.css';
5+
46
// import relative path
57
import Home from './Home';
68
import NotFound from './NotFound';
79

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

0 commit comments

Comments
 (0)