tianji/src/client/routes/__root.tsx

21 lines
601 B
TypeScript
Raw Normal View History

2024-03-20 18:00:23 +00:00
import { createRootRouteWithContext, Outlet } from '@tanstack/react-router';
import { TanStackRouterDevtools } from '@tanstack/router-devtools';
import { Suspense } from 'react';
2024-03-20 18:00:23 +00:00
interface RouterContext {
// The ReturnType of your useAuth hook or the value of your AuthContext
userInfo: any;
}
export const Route = createRootRouteWithContext<RouterContext>()({
component: () => {
return (
// https://github.com/TanStack/router/issues/857
<Suspense fallback={null}>
2024-03-20 18:00:23 +00:00
<Outlet />
<TanStackRouterDevtools position="bottom-right" />
</Suspense>
2024-03-20 18:00:23 +00:00
);
},
});