MENU
'match'
A match object contains information about how a path pattern matched a URL. Today it's called a PathMatch, and it contains the following properties:
params - Object
Key/value pairs parsed from the URL corresponding to the dynamic segments of the path.
pathname - String
The full portion of the URL that was matched (including anything captured by a trailing splat).
pathnameBase - String
The matched portion of the URL excluding any trailing splat. Useful for building nested <Link>s. This replaces what used to be called "url".
pattern - Object
The pattern that was matched against, as an object ({ path, caseSensitive, end }) rather than the plain string it used to be. Use pattern.path to get just the string.
The old "isExact" boolean is gone – matching is exact by default now, so getting a match back at all already tells you it was a full match (unless the pattern itself ends in a splat).
A 'match' object is returned in only two places today:
useMatch() as the return value
matchPath() as the return value
The <Route component=>/render=/children= props, and the withRouter HOC, that used to hand you a match object are all gone. If you only need the URL parameters (not the whole match object), useParams() is simpler and is what you'll reach for most often.