How to correctly use react-router? #69873
-
Somewhat new to react, and liking the library, but running into all kinds of headaches with the router. var React = require('react'); import App from './App'; export default (
{this.props.children}
);
}
// index.js
'use strict';
import React from 'react'; import Routes from './routes'; if ( process.env.NODE_ENV !== 'production') { ReactDOM.render(Routes, document.getElementById('main')); React |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Your routing is a bit flawed. Try this instead: This should solve most, if not all, of your errors.Share |
Beta Was this translation helpful? Give feedback.
Your routing is a bit flawed. Try this instead:
This should solve most, if not all, of your errors.Share
Follow
answered May 30, 2016 at 9:05
Chris's user avatar
Chris
59.1k2020 gold badges118118 silver badges141141 bronze badges
This feel, intuitively, like it should work. But I'm still getting all the same problems. –
jmknoll
CommentedMay 30, 2016 at 9:09
1
Are your dependencies updated? What version of react and react-router do you use? –
Chris
CommentedMay 30, 2016 at 9:14
React 0.14.8, and react-router 1.0.3. –
jmknoll
CommentedMay 30, 2016 at 9:21
1
I believe we've found the problem in that case. react-router v1.0.3 is nearly 6 months old. Latest version is 2.4.1. browserHistory wa…