+ 1
Error: [PrivateRoute] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>
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.