javascript - How do I get the active route pathname in react-router 1? -
i have route defined like:
<route path='/invite(/:invitetoken)' component={invitepage} key='/invite(/:invitetoken)' onenter={requireadmin} />
and current url is
/invite/abc123
in code, how current route, can path/key? (i need index array)
from docs: https://github.com/rackt/react-router/blob/latest/docs/introduction.md#adding-more-ui
<route path="messages/:id" component={message} />
now visits urls inbox/messages/jkei3c32 match new route , build you:
<message params={{ id: 'jkei3c32' }}/>
so in case, use this.props.params.invitetoken
in invitepage
component.
Comments
Post a Comment