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 "/"`2 Replies
eastern-cyan•7mo ago
you would need to use
from: rootRouteId
that's exported by react-routerwise-whiteOP•7mo ago
Thanks a lot