<Routes>

<Routes> looks at all of its child <Route> elements and renders only the one whose path best matches the current location. A <Route> only works when it is nested inside a <Routes> – unlike in React Router 5, a bare <Route> can no longer be rendered on its own outside a <Routes> ancestor.

<Routes> replaces what used to be called <Switch> in React Router 5. The name changed because its exclusive, single-best-match behavior is no longer optional or something a <Route exact> had to opt into – it's simply how matching always works now.

Attributes:

location: Location object

instead of the current URL, you can pass in a custom location to match. This is what powers patterns like showing a route in a modal while the page underneath still shows a different matched route (see Modal Gallery).