useRoutes for private public routes #10529
tapansharma211
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
Is below approach correct? will it cause any performance issues or any extra number of rerenders? I think this would be simpler and easier to manage over time but is it how it is meant to be used?
function App() {
const privateRoute = useRoutes(PrivateRoute());
const publicRoute = useRoutes(PublicRoute());
return checkIfUserIsAuthenticated() ? privateRoute : publicRoute ;
}
Note: public route consist of login screen which is not available in private route
Beta Was this translation helpful? Give feedback.
All reactions