How to get current route in react-router 2.0.0-rc5

后端 未结 9 1275
无人及你
无人及你 2020-12-08 18:05

I have a router like below:


    
        
          


        
9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 18:37

    After reading some more document, I found the solution:

    https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/location.md

    I just need to access the injected property location of the instance of the component like:

    var currentLocation = this.props.location.pathname
    

提交回复
热议问题