+ 1

Error: [PrivateRoute] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>

https://stackoverflow.com/questions/74455230/uncaught-error-publicroute-is-not-a-route-component-all-component-children

16th Nov 2022, 6:15 AM
Asha
Asha - avatar
1 Respuesta
0
I encapsulated the in PublicRoute.js, inside the and thanks to that the error resolved. return ( <Routes> <Route {...routeProps}>{children}</Route> </Routes> ); But still, the data is not showing and there's a warning in console instead : You rendered descendant <Routes> (or called useRoutes()) at "/signin" (under <Route path="/signin">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. Please change the parent <Route path="/signin"> to <Route path="/signin/*">. I did the changes as suggested, and now there're no errors or warnings but still the data is not shown on webpage.
18th Nov 2022, 5:04 AM
Asha
Asha - avatar