TanStackT
TanStack17mo ago
3 replies
absent-indigo

Getting loader data from parent route

So I see that it's possible to get loader data from parent routes but I have some questions.

1. In the component, is this the only way to get data from parent route AND current route?
const { projects } = Route.useLoaderData();
const { team } = useLoaderData({ from: '<parent-route>' });


2. In
meta
how do I access this loader data from parent route?
// only has the data from this route's loader but I would like to access `team` as well
meta: ({ loaderData: {projects} }) => {
    return [
      {
        title: 'Projects',
      },
    ];
  },
Was this page helpful?