How to retrieve the current route's parent? I need it in order to be able to navigate "up" in my app.
In child component's render -
var currentPath = this.props.location.pathname,
parentPath = currentPath.substring(0, currentPath.lastIndexOf("/"));
return (<Link to={parentPath}>Up</Link>...);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With