You are on page 1of 4

React Router: Parameters

Jogesh K. Muppala
React Router
• Paths specified as a URL
• Paths can also carry parameter values:
– e.g., /menu/42 where 42 is a route parameter
• Route parameters specified in the path
specification as a token
– e.g., path: ‘menu/:id’ where id is the token

Route Parameters
• Route parameters can be specified using a link parameter
while specifiyng the link
– e.g., <Link to{`/menu/${}`} >
• Route passes three props to the component:
– match, location, history

match Object
• match object provides information about how a <Route
path> matched the URL
– params: an object that contains key/value pair parsed from
the URL corresponding to the dynamic segments of the
– e.g. if path is specified as /menu/:id, then a path like
/menu/42 will result in being equal to