TanStackT
TanStack11mo ago
3 replies
verbal-lime

Get root context anywhere in the code

so in my __root.tsx file, i write to the root context :' beforeLoad: async () => { const session = await getServerSession(); return { session }; },`` is there a way to get that context anywhere in the code, in nested components? I triend const context = useRouteContext({ from: '/' }); but on nested root it does not work, i get the error: Invariant failed: Could not find an active match from "/"`
Was this page helpful?