Advertisement
MrB4RC0D3

__root.tsx

Apr 15th, 2024
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TypeScript 0.71 KB | Source Code | 0 0
  1. import { createRootRouteWithContext, Outlet } from "@tanstack/react-router";
  2. import { TanStackRouterDevtools } from "@tanstack/router-devtools";
  3. import Footer from "../components/Footer";
  4. import ErrorPage from "../pages/error/index.lazy";
  5. import { AuthSlice } from "../store/auth-slice";
  6.  
  7. interface MainRouterContext {
  8.     // The ReturnType of your useAuth hook or the value of your AuthContext
  9.     auth: AuthSlice;
  10. }
  11.  
  12. export const Route = createRootRouteWithContext<MainRouterContext>()({
  13.     component: () => (
  14.         <>
  15.             <Outlet />
  16.             <Footer />
  17.             <TanStackRouterDevtools position='top-right' />
  18.         </>
  19.     ),
  20.     notFoundComponent: () => <ErrorPage errorType={404} />,
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement