Is there any simple and convenient way to navigate to same route with different params?
for ex. I'm right now on /profile/idan and I wish to change the param of idan
to something else, instantly without dealing with the static part of the route.
Is there any simple and convenient way to navigate to same route with different params?
for ex. I'm right now on /profile/idan and I wish to change the param of idan
to something else, instantly without dealing with the static part of the route.
If your question is about v3 of the API, the react-router
library introduces a router
context. If you declare that in your contextTypes
, you'll have access to a push and replace method. Example:
import React, { Component, PropTypes } from 'react';
import { PropTypes as RouterPropTypes } from 'react-router';
class MyComponent extends Component {
// ...
handleSomeEvent() {
this.context.router.push('/some/url');
}
}
MyComponent.contextTypes = {
router: RouterPropTypes.routerShape
};
export default MyComponent;