-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hash and browser history integration #2347
Comments
please have a look into the docs https://github.com/rackt/react-router/blob/master/docs/guides/basics/Histories.md |
HI @knowbody I have read all your documentation carefully before asking you. My issue was coming from refactoring I have made to migrate to 1.0. routes.js before v1.0 export default (
<Route name='app' path='/' handler={Application}>
<Route name='home' path='/home' handler={HomeSection}/>
<Route name='todo' path='/todo' handler={TodoSection}/>
<Route name='contact' path="/contact" handler={Contact}/>
<DefaultRoute handler={HomeSection} />
<NotFoundRoute handler={NotFoundSection} />
</Route>
); v1.0 import createBrowserHistory from 'history/lib/createBrowserHistory';
const history = createBrowserHistory();
<Router history={history}>
<Route path='/' component={Application}>
<IndexRoute component={HomeSection} />
<Route path='home' component={HomeSection}/>
<Route path='todo' component={TodoSection}/>
<Route path='contact' component={Contact}/>
<Route path='*' component={NotFoundSection} />
</Route>
</Router> rendering before v1.0 const routes = require('./routes');
Router.run(routes, Router.HistoryLocation, (Handler) => {
React.render(<Handler/>, container);
}); v1.0 const routes = require('./routes');
render(<Router>{routes}</Router>, document.getElementById('app')); And here was my error. I wrapped a Router inside another Router but no warning helped me... v1.0 import createBrowserHistory from 'history/lib/createBrowserHistory';
const history = createBrowserHistory();
<Route path='/' component={Application}>
<IndexRoute component={HomeSection} />
<Route path='home' component={HomeSection}/>
<Route path='todo' component={TodoSection}/>
<Route path='contact' component={Contact}/>
<Route path='*' component={NotFoundSection} />
</Route> and v1.0 import createBrowserHistory from 'history/lib/createBrowserHistory';
const history = createBrowserHistory();
const routes = require('./routes');
render(<Router history={history}>{routes}</Router>, document.getElementById('app')); fixed the problem...was long to find |
@darul75 👍 glad you worked it out! |
maybe it can help someone else too...I had to read a lot of you issues too :) |
Hi all,
I am really fighting with new version which looks great but difficult when coming from previous versions.
Here is how my code looks like.
What I do not understand is why I always got url of types:
http://127.0.0.1:8080/#/home?_k=aocgkh
http://127.0.0.1:8080/#/contact?_k=lpfzmy
..
instead of
..
http://127.0.0.1:8080/home?_k=aocgkh
http://127.0.0.1:8080/contact?_k=lpfzmy
I am using latest version.
The text was updated successfully, but these errors were encountered: