TanStackT
TanStack2y ago
7 replies
foolish-indigo

Typing params for top level routes that might have them?

Is it possible to type params that might exist at a higher level? Aim here is to swap cookie values if a specific param value changes

const appRoute = createRoute({
  getParentRoute: () => rootRoute,
  id: "app",
  component: () => <AuthenticationGuard component={App} />,
  beforeLoad: ({ context: { cookies }, location, params }) => {
    // params?.userId
},
});
Was this page helpful?