T
TanStack12mo ago
exotic-emerald

Having two similar views in the same app

What is the best way to structure the routes in a react app using tanstack router to have two different views, they both sometimes use the same components and also have unique ones
4 Replies
xenial-black
xenial-black12mo ago
Hi I can help you
exotic-emerald
exotic-emeraldOP12mo ago
we can either discuss it here or in private basically I have two views, a viewer and an admin I want to be able to redirect the user to one of the views based on the role fetched from the auth (I can just mock it for now) my biggest problem is how the routing is going to work, for example if I have a dashboard page, I want to have one for the viewer and one for the admin, but for the user in the path he'll only see "/dashboard" not something like "/admin/dashboard" can you help by giving me an example of a folder structure if you have done something similar before? @Minima Takashi
xenial-black
xenial-black12mo ago
yeah excuse me where are u from?
exotic-emerald
exotic-emeraldOP12mo ago
Tunisia you?

Did you find this page helpful?