l2silver l2silver - 10 months ago 127
React JSX Question

react router get full current path name

Is there an easy way to return the current router address.

IE, if I'm on page, and I just want to see what page I'm on according to the react router.

So, localhost/admin/users would return admin/users

Obviously, I can get the same results by parsing the location, but I was wondering if react router provides a simple mechanism to do this, the same way it provides the params props?


If you're using 1.0 or newer, you have get the location as a prop in your React components that are matched against a route. So you just type


to get what you wanted.