T
TanStack2mo ago
sunny-green

Access another route's loader data

Is it possible to get another route's loader data? E.g. I'm on a product list page, I want to show links to products and I want some data from the product page's loader
2 Replies
exotic-emerald
exotic-emerald2mo ago
I am not sure, but you might be able to import the Route object of another route, or you can use the getRouteApi util to get it, then you should be able to call Route.useLoaderData you need to make sure there is a match for that route though, otherwise the useLoaderData might error
sunny-green
sunny-greenOP2mo ago
Thanks @ferretwithabéret ! I'll try this!

Did you find this page helpful?