Search code examples
reactjsreach-router

@reach/router: how to get the current route / page?


How does one get the current route for reach router. In react router one would get that through the params?

The docs don't currently show an example how to do this.


Solution

  • Use the this.props.location as it's passed down to the component:

    https://reach.tech/router/api/Router