diff --git a/packages/react-router/index.tsx b/packages/react-router/index.tsx index 098b26e4e8..cfa80dc33f 100644 --- a/packages/react-router/index.tsx +++ b/packages/react-router/index.tsx @@ -790,7 +790,7 @@ function flattenRoutes( let path: string; if (route.path.startsWith("/")) { invariant( - parentPath && !route.path.startsWith(parentPath), + !(parentPath && !route.path.startsWith(parentPath)), `Absolute must begin ` + `with its parent path "${parentPath}", otherwise it ` + `will be unreachable.`