Is is possible to use the same component for more than one route ?
I am migrating my project from React-Router to TanStack/Router. I have a component X that manages 2 routes /create and /:id/edit and based on the api calls I do inside, I handle the logic. Using TanStack/Router, I noticed that it's not possible to use the hook useLoaderData for each route in the same component. How to handle this problem? Is the only solution to split the logic ?
1 Reply
unwilling-turquoise•13mo ago
what exactly prevents you from using the
useLoaderData
hook inside the component?
can you please provide a minimal complete example by forking one of the existing router examples on stackblitz?