Skip to content

Commit 72b1345

Browse files
xavier-lcXavier Lozano Carreras
andauthored
fix: Pass along location prop from CompatRoute to the Routes it renders (#8862)
* fix: Pass along `location` prop from `CompatRoute` to the `Routes` it renders * Add xavier-lc to contributors * PR feedback Co-authored-by: Xavier Lozano Carreras <[email protected]>
1 parent fabd82e commit 72b1345

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@
7070
- vijaypushkin
7171
- vikingviolinist
7272
- williamsdyyz
73+
- xavier-lc

packages/react-router-dom-v5-compat/lib/components.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import { Router, Routes, Route } from "../react-router-dom";
1414
// v5 isn't in TypeScript, they'll also lose the @types/react-router with this
1515
// but not worried about that for now.
1616
export function CompatRoute(props: any) {
17-
let { path } = props;
17+
let { location, path } = props;
1818
if (!props.exact) path += "/*";
1919
return (
20-
<Routes>
20+
<Routes location={location}>
2121
<Route path={path} element={<RouteV5 {...props} />} />
2222
</Routes>
2323
);

0 commit comments

Comments
 (0)