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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -