[英]How to access abstract current path in react-router v4
Using react-router v4, how should I go about getting the current abstract path. 使用react-router v4,我应该如何获取当前的抽象路径。 For example, I can access
this.props.location
when using withRouter(...)
but this gives /students/19
, when I want students/:id
etc. This functionality is desired for a logging tool. 例如,当使用
withRouter(...)
时,我可以访问this.props.location
,但是当我想要students/:id
等时,它给出/students/19
此功能是日志记录工具所需要的。
How should I accomplish this? 我应该如何做到这一点?
Use this.props.match.path
. 使用
this.props.match.path
。 I believe that's what you need. 我相信这就是您所需要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.