I have code similar to the following:
var browserHistory = ReactRouter.browserHistory; var Router = ReactRouter.Router; var Route = ReactRouter.Route; var Link = ReactRouter.Link; class App extends React.Component { render() { return ( <div> <h1>Here is content:</h1> {this.props.children} <Link to="/Welcome">Welcome</Link> | <Link to="/Login">Login</Link> <a href="/">REFERENCE LINK</a> </div> ); } } class Welcome extends React.Component { render() { return ( <div> <h1>No hejaaaa - welcome</h1> </div> ); } } class Login extends React.Component { render() { return ( <div> <h1>No hejaaaa - Login</h1> </div> ); } } const Routes = ( <Router history={browserHistory}> <Route path="/" component={App}> <Route path="Welcome" component={Welcome}/> <Route path="Login" component={Login}/> <Route path="*" component={Welcome}/> </Route> </Router> ); // init file: var RouterContext = ReactRouter.RouterContext var match = ReactRouter.match match({ routes: Routes, location: document.location.pathname }, (err, redirectLocation, renderProps) => { ReactDOM.render(<RouterContext {...renderProps} />, document.querySelector('#app')); });
The markup is generated correctly, but the problem is that clicking in the links does not work at all. Am I doing something wrong?
My libraries:
- "react": "0.14.7",
- "reaction": "0.14.7",
- reaction router: 2.0.0
JSFIDDLE: https://jsfiddle.net/Lp3gzott/ (same code, but updated)
reactjs react-router
Cezary daniel nowak
source share