javascript - Get the path of a certain Route in react-router -


using react-router in react have declared routes this:

<route name="voteview" path="voteview/:baselineid" handler={voteview}/> 

in react component, want call route. react router gives me link:

<link to="voteview" params={{baselineid: this.props.data.baselineid}}>voteview</link> 

this results in <a href...> link.

but want use url path programmatically, not in <a href...> link. how can url path "voteview" route programmatically?

you can use makehref method on react routers context generate path this:

this.context.router.makehref('voteview', {baselineid: this.props.data.baselineid}) 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -