sorry for my poor English..my question is,when i use <Link/>
to change current route into next route,how i can get previous path in next route's handler? here is some code
// route config
<Route handler={Route2} name="route2" path="route2" />
// eg: current location is #/route1?key=value
<Link to="route2">click to jump to route2</Link>
// route2
var Route2 = React.createClass({
componentDidMount: function() {
// how i can get previous path '#/route1?key=value'
},
render: function() {
return (
<div />
)
}
})
thx ~ :-)
Apparently there's no sanctioned way to do that.
As suggested in this issue, you can save the previous path in
router.run
.Beware, however, that this will point "forward" after using the browser back button.