stkvtflw stkvtflw - 8 days ago 6
React JSX Question

React router change url without page reload

When I was using react-router 0.13.3, it was ok: i was changing url and transition without reload was happening.

Now, in react-router 2.0 if I'm changing url manually, my app gets reloaded entirely instead of simple redirect.
How do i fix it?

I want to use this:

<a href="/routename">link</a>


instead this:

<Link to="/routename">link</Link>


In few special cases.

Routes



import {Router, Route, IndexRoute} from "react-router";
import App from './components/App';
import FrontPage from './components/frontPage/FrontPage';
import User from './components/user/User';
module.exports = (
<Router>
<Route path="/" component={App}>
<IndexRoute component={FrontPage}/>
<Route path="/user/:userid" component={User}/>
</Route>
</Router>
);

Answer

There is no solution. We can either onClick script or Link.

https://github.com/reactjs/react-router/issues/3411