Skip to content

Commit 5f5aeb4

Browse files
committed
fix: get CompatRoute to match partially
1 parent 0188810 commit 5f5aeb4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ import { Router, Routes, Route } from "../react-router-dom";
1515
// but not worried about that for now.
1616
export function CompatRoute(props: any) {
1717
let { path } = props;
18+
if (typeof path !== "string") {
19+
console.warn(
20+
`React Router v6 only supports strings for route paths, received: ${path}`
21+
);
22+
}
23+
if (path.includes("?")) {
24+
console.warn(
25+
`React Router v6 does not support optional segements supports strings for route paths. Repeat the route definition with each set of params instead. Received ${path}`
26+
);
27+
}
28+
29+
if (!props.exact) {
30+
path += "/*";
31+
}
32+
1833
return (
1934
<Routes>
2035
<Route path={path} element={<RouteV5 {...props} />} />

0 commit comments

Comments
 (0)