How can I pass additional parametrs to the component that I am transitioning to.
I have my routes.js as follows. I have declared two paths one for authorList and another for a particluar author's details.
var routes = (
<Route path="/" component={require('./components/main')}>
<Route path="authors" component={require('./components/authors/authorPage')}/>
<Route path="authors/:authorId" component={require('./components/authors/AuthorDetails')}/>
</Route>
);
module.exports = routes;
And in my authorList Page there is function as follows.
showAuthorDetails(authorId) {
var myExtraParams = { key1 : val1, key2 : val2};
hashHistory.push(`/authors/${authorId});
}
Now In my AuthorDetail page I can get authorId by doing
this.props.params.authorId
But I also want to pass myExtraParams as an object but don't want to declare and pass it in the url. I want to somehow access myExtraParams in the new component, perhaps say like by doing
this.props.params.myExtraParams
should give mt the object. (Like the way it happens in Angular UI router by using stateParams)
How can I do that?