-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.tsx
More file actions
29 lines (25 loc) · 839 Bytes
/
router.tsx
File metadata and controls
29 lines (25 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { createRouter, RouterProvider } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen'
import { NotFound } from './pages/NotFound'
import { initializeGoogleAnalytics } from './shared/hooks/useGoogleAnalytics'
// Initialize Google Analytics
const gaTrackingId = (import.meta.env.VITE_GA_TRACKING_ID as string | undefined)
if (gaTrackingId) {
initializeGoogleAnalytics(gaTrackingId)
}
// Create a new router instance
const router = createRouter({
routeTree,
defaultNotFoundComponent: NotFound
})
// Register the router instance for type safety
declare module '@tanstack/react-router' {
interface Register {
router: typeof router
}
}
/**
* Router Component
* Provides routing functionality using TanStack Router
*/
export const AppRouter = (): JSX.Element => <RouterProvider router={router} />