Using Router Props

Learn how you can access and use the props of React Router.

Accessing React Router props

Each component that was rendered by React Router and has been added as a component prop to a Route component automatically receives three other props:

  1. match
  2. location
  3. history

Each of these props can be accessed just like any other prop. class components can access these via this.props whereas function components can access these with props:

Get hands-on with 1200+ tech skills courses.