File tree Expand file tree Collapse file tree 4 files changed +1649
-1074
lines changed Expand file tree Collapse file tree 4 files changed +1649
-1074
lines changed Original file line number Diff line number Diff line change 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 )
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 11import 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
57import Home from './Home' ;
68import NotFound from './NotFound' ;
79
8- // add router key to fix this issue
9- // https://github.com/reactjs/react-router-redux/issues/179#issuecomment-275576250
1010const 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
You can’t perform that action at this time.
0 commit comments