import { Router, Route, IndexRoute, IndexLink, browserHistory } from 'react-router'; : <Router history={browserHistory}> <Route path='/' component={App}> <IndexRoute component={Top} /> <Route path='hoge' component={Hoge} /> </Route> </Router>
import { Route, BrowserRouter } from 'react-router-dom'; : <BrowserRouter> <div> <Route exact={true} path='/' component={Top}/> <Route path='hoge' component={Hoge}/> </div> </BrowserRouter>
<Route path="/one"> <IndexRedirect to="1" /> <Route path="1" component={First} /> <Route path="2" component={Second} /> </Route>
<Route path="/one"> <Switch> <Route exact path="/one/1" component={First} /> <Route exact path="/one/2" component={Second} /> <Redirect to="/one/1" /> <== パスがマッチしなかった場合は最後に書くこと! </Switch> </Route>
$ npm un -S react-router && npm i -S react-router-dom